【发布时间】:2015-04-14 13:46:50
【问题描述】:
我需要为节点着色以在 R 中绘制图形社区(节点集)。对于这种情况,我处理 17 个社区(所以我需要 17 种不同的颜色)。我使用此命令为节点着色。
V(g5)$color<- ifelse(V(g5)$name %in% V(g3)$name,com$membership+1, "white")
com$membership
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 6 6 6 6 6 6 6 6 7 7 8 8 8 8 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 11 11 11 11 11 11 12 12 13 13 13 13 14 14 14 14 15 15 15 15 16 17 17 9 14
并绘制:
plot(g5, vertex.color=V(g5)$name)
我只得到 6 种颜色的问题,它会重复给其他社区。如何正确地为这 17 个社区着色?
【问题讨论】:
-
您应该发布reproducible example。尚不清楚
g5和g3和com之间的关系。 -
'g5' 和 'g3' 是两个图,'com' 是社区结构,即节点所属的社区。span>