我正在尝试从矩阵构建网络,以便我可以绘制整个网络或仅绘制顶点的子集。我一直在使用 R 中的 Network 包并创建了一个玩具网络,我在其中向顶点添加了两个属性:“年份”和“主题”。然后我绘制网络,使主题颜色不同。
library(network)
B = matrix(c(1, 1, 0, 1, 1,0,1,1,0,1,1,0,0,0,1,0,0,1,1,0,1,0,0,1,0), nrow=5, ncol=5)
b<-network(B)
b %v% "topic"=c("Surveillance","Inspection efficiency","Surveillance","Inspection efficiency","Surveillance")
b %v% "year"=c(2006,2006,2007,2007,2007)
ggnet2(b,node.size = 10, node.color = "topic", edge.size = 1, edge.color = "grey",palette = "Set2",label=c("1101","908","1107","601","604"),label.size = 3)`
我想做的是绘制这个相同的网络,但仅用于属性“年”的值为“2006”的顶点。欢迎大家提出意见