我正在使用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)
Run Code Online (Sandbox Code Playgroud)
如您所见,我的边缘标签(箭头标签)重叠.怎么解决这个?
提前致谢!
这是执行此操作的代码。它使用边缘列表而不是 igraph,但它是一个看起来更酷的图。
library(qgraph)
qgraph(mydata,edge.labels=T)
Run Code Online (Sandbox Code Playgroud)
查看这篇文章了解更多详细信息
使用 qgraph 的帮助页面: http://rgm3.lab.nig.ac.jp/RGM/R_rdfile ?f=qgraph/man/qgraph.Rd&d=R_CC