Skip to content

Instantly share code, notes, and snippets.

@cndesantana
Created January 26, 2016 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cndesantana/43468b24b365c44443af to your computer and use it in GitHub Desktop.
Save cndesantana/43468b24b365c44443af to your computer and use it in GitHub Desktop.
library(igraph)
nnodes = 100;#number of nodes is 100
g<-erdos.renyi.game(nnodes,0.07);#random graph with nnodes nodes
ypos<-round(runif(nnodes,min=0,max=3))#positions between 0 and 10
mysizes<-runif(nnodes,min=8,max=16)#sizes between 3 and 10
xpos<-runif(nnodes)
mylayout<-as.matrix(cbind(xpos,ypos))
png("./test.png",width=1980,height=1240,res=100)
plot(g, layout=mylayout, vertex.size=sizes, axes = FALSE, rescale=FALSE, ylim=range(ypos), vertex.size=mysizes)
dev.off();
@cndesantana
Copy link
Author

Below is the resulting figure

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment