2017-05-18 1 views
3

두 번째 내부 원을 현재 정점에 추가하고 싶습니다. 특정 변수에 비례해야합니다. 여기에 예를igraph R | 각 노드에 대해 두 번째 내부 원을 추가하는 방법은 무엇입니까?

는 : 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"를 추가하십시오. 그것이 그대로, 두 번째 모서리를 오버플로합니다. – lukeA

관련 문제