Igraph R | How do I add a second inner circle for each node?

I would like to add a second, inner circle to the current vertices. It should be proportional to some variable.

Here's an example: enter image description here

I already know how to do this for the main circle, i.e. the size of the vertex.

variable1 <- c(20,40,60) # this will define the size of the vertices
g1 <- graph(edges=c(1,2, 2,3, 3,1), n=3, directed=F)
V(g1)$size <- variable1 # this assigns the vertices size to the igraph object 'g1'
plot(g1)
variable2 <- c(10,20,30) # this would be needed for a second, internal circle, ideally in a different color

      

Any ideas?

+3


source to share


1 answer


You may try

library(igraph)
variable1 <- c(20,40,60) # this will define the size of the vertices
variable2 <- c(10,20,30) # this would be needed for a second, internal circle, ideally in a different color
g1 <- graph(edges=c(1,2, 2,3, 3,1), n=3, directed=F)
V(g1)$size <- variable1 # this assigns the vertices size to the igraph object 'g1'
coords <- layout.auto(g1)
plot(g1, layout=coords, vertex.frame.color="orange", vertex.color=NA, vertex.label = NA)
plot(g1, layout=coords, vertex.size=variable2, add=T, vertex.color="lightgray")

      



enter image description here

+3


source







All Articles