我正在使用R中的igraph软件包来可视化网络流。
library(igraph)
# Example Data:
b <- c("countryA", "countryB", "countryC", "countryA", "countryC", "countryA")
c <- c("countryB", "countryC", "countryA", "countryB", "countryA", "countryB")
d<- c(100, 200, 200, 300, 400, 200)
e <- c(5,12,10,24,25,12)
mydata <- data.frame(b,c,d,e)
colnames(mydata) <- c("exporteur", "partner", "tradeflow", "price")
# Plot in igraph
mydata.igraph <- graph.data.frame(mydata)
E(mydata.igraph)$label <- mydata[,3]
plot(mydata.igraph)
如您所见,我的边缘标签(箭头标记)重叠了。如何解决呢?
提前感谢!
vertex.label.dist
是可能的,但对于边缘似乎还没有(https://bugs.launchpad.net/igraph/+bug/530802)。 - user1317221_Gsna
包,可能支持它,尽管我没有检查,所以不确定。如果你想绘制图表,你也可以看看diagram
包。要使用igraph进行绘图,你需要使用text()
函数将标签作为额外步骤进行绘制。 - Gabor Csardi