figshare
Browse
graph.png (384.15 kB)

Constructing petridish plots in R

Download (0 kB)
figure
posted on 2012-09-14, 09:52 authored by Prabhav KalaghatgiPrabhav Kalaghatgi

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)

History

Usage metrics

    Licence

    Exports

    RefWorks
    BibTeX
    Ref. manager
    Endnote
    DataCite
    NLM
    DC