Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
igraph R |如何为每个节点添加第二个内圆?_R_Plot_Nodes_Igraph - Fatal编程技术网

igraph R |如何为每个节点添加第二个内圆?

igraph R |如何为每个节点添加第二个内圆?,r,plot,nodes,igraph,R,Plot,Nodes,Igraph,我想在当前顶点上添加第二个内圆。它应该与某个变量成比例 这里有一个例子: 我已经知道如何处理主圆,也就是顶点大小 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 t

我想在当前顶点上添加第二个内圆。它应该与某个变量成比例

这里有一个例子:

我已经知道如何处理主圆,也就是顶点大小

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
variable1您可以尝试

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")
库(igraph)

变量1很好的技巧。是否可以使边缘从外环开始?@fibar是的,只需将
edge.lty=“blank”
添加到第二个边缘即可。就目前而言,它过度绘制了第二组边。