Skip to content
Prev 268955 / 398502 Next

igraph - designing graph plot by attributes

Create a factor variable for the different age categories, see cut().
Then use as.integer() on the factor variable and index a vector of
node sizes with it. E.g.

g <- graph.ring(10)
V(g)$age <- sample(20:78, vcount(g), replace=TRUE)
V(g)$agecat <- cut(V(g)$age, breaks = c(20,35,50,65,78))
V(g)$size <- c(10,15,20,25)[ V(g)$agecat ]

plot(g, layout=layout.circle)

Best,
Gabor

On Wed, Aug 10, 2011 at 1:38 PM, Gaitan, Andreea
<andreea.gaitan10 at imperial.ac.uk> wrote: