使igraph更清晰阅读

时间:2014-10-06 14:52:00

标签: r igraph network-analysis

我有一个带有69个顶点的有向图,如下所示。它是使用igraph包绘制的:

library(igraph)
ig <- graph.adjacency(data, mode="directed", weighted=TRUE) 
plot(ig)

我希望实现以下两件事:

(a)将顶点对齐并可能拉长边缘以使其更容易阅读

(b)实际上,我的标签更长。是否可以使顶点更大,文本更小以适应这种情况。

有什么想法吗?

以下是我的数据:https://www.dropbox.com/s/rtedrd1x1duqllj/data.Rdata?dl=0

igraph http://i61.tinypic.com/rsczdj.png

1 个答案:

答案 0 :(得分:5)

所有参数都可以高度自定义。我用顶点标签替换了州名:

# this ensures the starting random position is the same
# for the layouts that use a random starting position
set.seed(1492) 

l <- layout.fruchterman.reingold(ig, niter=5000, area=vcount(ig)^4*10)

plot(ig, layout=l, 
     edge.arrow.size=0.5, 
     vertex.label.cex=0.75, 
     vertex.label.family="Helvetica",
     vertex.label.font=2,
     vertex.shape="circle", 
     vertex.size=1, 
     vertex.label.color="black", 
     edge.width=0.5)

enter image description here

你需要花些时间阅读help("igraph.plotting")&amp; help("layout")