Constructing petridish plots in R
Description
A sample script for constructing petridish-like plots in R
library(igraph)
# set graph size
g <- graph.empty(directed=FALSE)
node_id <- c(1:1000)
g <- add.vertices(g,nv=1000,vert_colour=sample(c('blue','red','yellow','green','purple'),1000,replace=T)
)
# edge list
E <- sample(0:999,2000,replace=T)
g <- add.edges(g,E)
# optimize layout
lay <- layout.fruchterman.reingold(g)
# plot graph
plot(g,layout=lay,vertex.label='',vertex.size=2,vertex.color=V(g)$vert_colour)
Comments (0)
You must be logged in to post comments.
1049
views
Published on 14 Sep 2012 - 09:52 (GMT)
Filesize is 375.15 KB
Categories
Authors
Cite "Filename"
Embed "Constructing petridish plots in R"
Claim article
You claim request was sent. I will be handled in the next 24 hours.
Close window