【发布时间】:2022-11-11 01:46:40
【问题描述】:
我正在 iGraph 中绘制一个二分网络。我用来创建图形的 csv 是一个边缘列表,格式如下
| V1 | V2 |
|---|---|
| node1 | node3 |
| node4 | node7 |
| node1. | node4. |
从那里我习惯了以下代码:
g <- graph.data.frame(df, directed=FALSE)
bipartite_mapping(g)
V(g)$type <- bipartite_mapping(g)$type
plot(g)
plot(g, vertex.label.cex = 0.8, vertex.label.color = "black")
V(g)$color <- ifelse(V(g)$type, "lightblue", "salmon")
V(g)$shape <- ifelse(V(g)$type, "circle", "square")
E(g)$color <- "lightgray"
plot(g, vertex.label.cex = 0.8, vertex.label.color = "black")
但是,无论我如何更改颜色标签或其他顶点属性,我都无法让顶点标签(node1、node2 等)显示在图中。
我错过了什么?
非常感谢您的帮助!让自己发疯,我敢肯定这很简单,但我在网上找不到答案。
【问题讨论】: