r中的igraph包:边缘标签重叠 [英] igraph package in r: edge labels are overlapping
本文介绍了r中的igraph包:边缘标签重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用R中的igraph软件包来可视化网络流.
I am working with the igraph package in R to visualise network flows.
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)
如您所见,我的边缘标签(箭头的标签)是重叠的.怎么解决呢?
As you can see, my edge labels (labels of the arrows) are overlapping. How to solve this?
提前谢谢!
推荐答案
这是执行此操作的代码.它使用边列表而不是igraph,但是它看起来很酷.
This is the code to do it. It uses the edgelist instead of the igraph, but it is a cooler looking graph.
library(qgraph)
qgraph(mydata,edge.labels=T)
查看此帖子以获取更多详细信息
Check out this post for a more detail
此使用qgraph的帮助页面: http://rgm3. lab.nig.ac.jp/RGM/R_rdfile?f=qgraph/man/qgraph.Rd&d=R_CC
And this help page for using qgraph: http://rgm3.lab.nig.ac.jp/RGM/R_rdfile?f=qgraph/man/qgraph.Rd&d=R_CC
这篇关于r中的igraph包:边缘标签重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文