So, after Correct, "full length" left-right arrows in Matplotlib?, I realized there is another bit that I find tricky with Matplotlib arrows; consider this example:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot()
ax.plot([0],[0])
ax.grid()
ax.set_xlim([0,10])
ax.set_ylim([0,10])
ax.annotate("", (2, 1), (4, 1), arrowprops={'arrowstyle':'<->', 'shrinkA': 0, 'shrinkB': 0})
ax.annotate("", (4, 1), (6, 1), arrowprops={'arrowstyle':'<->', 'shrinkA': 0, 'shrinkB': 0})
plt.show()
Basically, here the first arrow points to the point (x=4, y=1) rightwards as its end, and the second arrow points to the same point leftwards as its start:
... and actually, it does look fine with a grid.
However, if I remove the grid (comment the ax.grid()
line), I get this:
So in this case, I can see that the arrowheads pointing to (4,1) from both sides do not touch each other - and I would like them to do so, to give a visual indication that they are both pointing to the same point. If we use an image application to zoom in:
... it is clear that the gap between the arrowheads is only one pixel.
Essentially, I would need the opposite of the shrink*
parameter (something like "extend") - I couldn't find something like that, so I tried to cheat by giving shrink*
negative values, but they produce the same result as the positive values (they explicitly do shrinking).
Is there any way I could achieve this? Just to clarify - I'd hope to obtain the following (that is, the 1-pixel wide gap on previous image, is also drawn):
... which when zoomed out, would look like this: