Constructing petridish plots in R

2012-09-14T09:52:24Z (GMT) by Prabhav Kalaghatgi
<p>A sample script for constructing petridish-like plots in R</p> <p>library(igraph)</p> <p># set graph size</p> <p>g <- graph.empty(directed=FALSE)</p> <p>node_id <- c(1:1000)</p> <p>g <- add.vertices(g,nv=1000,vert_colour=sample(c('blue','red','yellow','green','purple'),1000,replace=T)<br>)<br># edge list</p> <p>E <- sample(0:999,2000,replace=T)</p> <p>g <- add.edges(g,E)</p> <p># optimize layout</p> <p>lay <- layout.fruchterman.reingold(g)</p> <p># plot graph</p> <p><br>plot(g,layout=lay,vertex.label='',vertex.size=2,vertex.color=V(g)$vert_colour)</p>
Comments are currently unavailable