如何在R中的简单网络图上添加标签?提供的代码

再次需要帮助

我正在使用以下代码加载弗洛伦汀数据集,并试图形象化网络:

library("ergm")
data("florentine")
require(intergraph)
require(igraph)
marriages <- asIgraph(flomarriage)

# Calculate degree centrality
V(marriages)$degree <- degree(marriages)

# Plot
plot(marriages, 
     vertex.label.cex = .6, 
     vertex.label.color = 'blue')

结果:

网络

问题:节点具有数字,而不是数据集中存在的族的名称(称为vertex.names)。如何用名称替换节点号?例如,我可以使用标签功能吗?

F18
# ?igraph.plotting
plot(marriages, vertex.label = V(marriages)$vertex.names)

该参数记录在您找到所用其他参数的页面上。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章