【R 可视化】R 画关系网络图

 rm(list=ls())
library(igraph)
#1.用igraph创建图表
g<- graph(c(1,2, 1,8,1,9,1,10,2,4,2,5,2,6,2,3,3,7,3,11,3,12,3,1), directed=T)

com = walktrap.community(g, steps = 6)
V(g)$sg = com$membership + 1
V(g)$color = rainbow(max(V(g)$sg))[V(g)$sg]
plot(g, layout=layout.fruchterman.reingold,edge.color = grey(0.4),edge.arrow.mode = ">",vertex.size =20,
     vertex.color = V(g)$color)

这里写图片描述

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页