Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making igraph clearer to read

I have a directed igraph with 69 vertices, shown below. It was plotted using the igraph package:

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

I'm looking to achieve the following 2 things:

(a) Space the vertices out and maybe lengthen the edges to make it a little easier to read

(b) In reality, my labels are longer. Is it possible to make a vertex bigger and the text smaller to accommodate this.

Any ideas?

Here is my data: https://www.dropbox.com/s/rtedrd1x1duqllj/data.Rdata?dl=0

igraph

like image 650
user2846211 Avatar asked Oct 06 '14 14:10

user2846211


1 Answers

All of the parameters are definitely highly customizable. I substituted state names for your vertex labels:

# 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

You shld rly take some time to read help("igraph.plotting") & help("layout")

like image 92
hrbrmstr Avatar answered Oct 08 '22 08:10

hrbrmstr