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.mode
option 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.
library(igraph)
# Zoom in on the critical region, although the gap always has the
# same size, unless you make the plotting window bigger
g <- graph(c(1,2), directed=FALSE)
par(mar=c(0,0,0,0))
plot(g, edge.width=2, vertex.size=20, edge.color='black', main='',
rescale=FALSE, xlim=c(0.9,1), ylim=c(0.9,1),
layout=rbind(c(0,0), c(1,1)), vertex.color="#ffffff11")
# This plot should have no gaps
g2 <- as.directed(g, mode="mutual")
par(mar=c(0,0,0,0))
plot(g2, edge.width=2, vertex.size=20, edge.color='black', main='',
rescale=FALSE, xlim=c(0.9,1), ylim=c(0.9,1),
layout=rbind(c(0,0), c(1,1)), vertex.color="#ffffff11",
edge.arrow.mode="-")
library("qgraph");qgraph(edges)
in which this behavior should not occur. – Sacha Epskamplayout()
(theigraph
function) to return coordinates of vertices, then plot your own graph from scratch. Plot edges first then vertices on top. – digitalmaps