【问题标题】:How to Add Label to Simple Network Plot in R? Code Provided如何在 R 中为简单网络图添加标签?提供的代码
【发布时间】:2021-05-09 01:11:02
【问题描述】:

我正在使用下面的代码加载佛罗伦萨数据集并尝试可视化网络:

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')

结果:

Network

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

【问题讨论】:

    标签: r plot igraph


    【解决方案1】:
    # ?igraph.plotting
    plot(marriages, vertex.label = V(marriages)$vertex.names)
    

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

    【讨论】:

      猜你喜欢
      • 2016-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-25
      • 1970-01-01
      • 2018-07-07
      • 1970-01-01
      相关资源
      最近更新 更多