HeyHoLetsGo
HeyHoLetsGo

Reputation: 147

igraph; distance between nodes

I'm using igraph

g <- graph_from_adjacency_matrix(adj2, mode = "directed") 

plot.igraph(g, vertex.size = 0.01, edge.arrow.size = 0.09, vertex.label.cex = 0.3, vertex.color = "white", vertex.shape = "none")

The problem that I have is that some nodes fall pretty close from each other and when I print it is hard to see some nodes.

I want to somehow to set a bigger distance between nodes that fall close (the central cluster of nodes, for example).

thanks!

enter image description here

Upvotes: 5

Views: 5414

Answers (1)

Daniel
Daniel

Reputation: 572

You can use some layouts to extract the network and make it more readable. This can be done by different layouts, here an example for the fruchterman.reingold algorithm:

plot.igraph(g, layout =  layout.fruchterman.reingold, vertex.size = 0.01, edge.arrow.size = 0.09, vertex.label.cex = 0.3, vertex.color = "white", vertex.shape = "none")

Another example would be to use the layout=layout.auto. You have to look which layout fits better to your data.

You can read more about different layouts in the CRAN documentation igraph

Upvotes: 5

Related Questions