Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R igraph - specify the minimum space in between vertices

Tags:

r

igraph

Is there a way to set the minimum space in between two vertices in igraph so that the vertices don't look smashed together? The graph can be as big as needed.

like image 825
md1630 Avatar asked Oct 31 '22 08:10

md1630


1 Answers

There might be, but an indirect way is to minimize the vertex.size and, if needed, vertex.label.cex. Making your device larger should then maximize space between nodes.

ex:

library(igraph)
my.graph <- graph.lattice(length = c(4,4), dim = 1, directed = FALSE)
plot(my.graph,
       layout = layout.grid,
       vertex.label=toupper(1:16),
       vertex.size = 20,
       vertex.shape = "square",
       vertex.color="white",
       vertex.frame.color= "black",
       vertex.label.color = "black",
       vertex.label.family = "sans",
       vertex.label.cex=1,
       edge.width=2,
       edge.color="black")

enter image description here

like image 121
Dominic Comtois Avatar answered Nov 09 '22 16:11

Dominic Comtois