Consider a plot of a very simple undirected graph produced with igraph.
library(igraph)
edges = matrix(c(1,2), nrow=1, ncol=2)
g = graph.edgelist(edges, directed=FALSE)
set.seed(42)
plot(g, edge.width=2, vertex.size=30, edge.color='black', main='')
There is a small gap between the edge and vertex 2, but not between the edge and
vertex 1. Is there a way of removing that gap?
The graph I am really working with is larger and edges are a lot
shorter. While the gap goes almost unnoticed in the above example, it is
confusing in my case.
This is indeed a bug in igraph, and it happens because igraph leaves some space there for the arrow-head, even if the arrow-head is not there. I will fix it in the next igraph version.
As a workaround, what you can do is plotting each edge twice, on top of each other. For this you need to make your graph directed and then use the
edge.arrow.modeoption to avoid the arrows. This works because only one end of the edge is modified by the arrow plotter. Somewhat stupid to plot your graphs this way, but I cannot find a better workaround for now. As I said, the new version (the one after 0.6.4) will not have this problem.