2017-05-18 23 views
3

現在の頂点に2番目の内部円を追加したいとします。特定の変数に比例する必要があります。ここでigraph R |各ノードに2番目の内部円を追加する方法は?

例: enter image description here

私はすでにメインのサークルのために、それは、頂点のサイズであることを行う方法を知っています。

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 

任意のアイデア?

答えて

3

あなたは

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

+0

ニーストリックを試みることができます。エッジを外部リングから始めることは可能ですか? – fibar

+0

@fibarはい、 'edge.lty =" blank "を第2のものに追加するだけです。それが立つと、それは第2のエッジのセットを上書きする。 – lukeA