Open EnigmaSong opened 1 year ago
Generate figures using the following codes:
library(igraph)
png("inst/violin_summary/v_shape.png")
# par(mfrow=c(2,1),mar=c(0,0,0,0))
v_shape <- graph_from_adjacency_matrix(matrix(c(0,1,0,1,0,1,0,1,0),3,3), mode="undirected")
v_shape$layout <- layout_in_circle
plot(v_shape, vertex.label=NA, vertex.size = 20, edge.width = 20)
dev.off()
png("inst/violin_summary/one_edge.png")
one_edge_three_nodes <- graph_from_adjacency_matrix(matrix(c(0,0,0,0,0,1,0,1,0),3,3), mode="undirected")
one_edge_three_nodes$layout <- layout_in_circle
plot(one_edge_three_nodes, vertex.label=NA, vertex.size = 20, edge.width = 20)
dev.off()
png("inst/violin_summary/triangle.png")#,width = 120, height= 120)
par(mar=c(0,0,0,0))
plot(make_ring(3), vertex.label=NA, vertex.size = 20, edge.width = 20)#triangle
dev.off()
png("inst/violin_summary/square.png")
par(mar=c(0,0,0,0))
plot(make_ring(4), vertex.label=NA, vertex.size = 20, edge.width = 20)#square
dev.off()
png("inst/violin_summary/pentagon.png")
par(mar=c(0,0,0,0))
plot(make_ring(5), vertex.label=NA, vertex.size = 20, edge.width = 20)#pentagon
dev.off()
png("inst/violin_summary/hexagon.png")
par(mar=c(0,0,0,0))
plot(make_ring(6), vertex.label=NA, vertex.size = 20, edge.width = 20)#hexagon
dev.off()
png("inst/violin_summary/septagon.png")
par(mar=c(0,0,0,0))
plot(make_ring(7), vertex.label=NA, vertex.size = 20, edge.width = 20)#septagon
dev.off()
The earlier version causes issue on R CMD CHECK.
This is due to the path of image files. I put the image files under inst/violin_summary
folder as above, but when R CMD CHECK runs, file is under nethist/viloin_summary
while the test code is in tests/test_that
.
This post would be helpful
Here is the code from the post: