You can clone with
HTTPS or Subversion.
I was playing around, trying to give a simple version of the use of arrow in an attempt to fix issue #1096, and I think I found a bug. The arrow head does no sit square with the arrow base. Below is a snippet that reproduces the bug:
from matplotlib.backends.backend_pdf import FigureCanvasPdf as fc
from matplotlib.figure import Figure
fig = Figure()
can = fc(fig)
ax = fig.add_subplot(1, 1, 1)
ax.arrow(0, 0, 0.5, 0.5, head_width=0.05, head_length=0.1, fc='k', ec='k')
And here is my sample output.
@leejjoon : Any thoughts, as one who knows the arrow code so well?
My guess is perhaps the shape of the arrow head is affected by the current transform, but I tried using square axes and it still looks weird to me. Does it look weird to anyone else?
On setting ax.set_aspect('equal'), I see the arrow head sits square with the stem now. I guess when I made the figure square, the axes were not square because of the room needed to be made for the tick labels.
This, then, raises an interesting question: Should the arrow be squashed with the axes? Since the base and tip are decided in the method call, we know already that the arrow head will not spill over the axes boundary.
Axes.arrow creates a simple Polygon patch. And by default the coordinates of polygon is in data transform.
So, unless axes has an aspect=1, the shape of the arrow can be incorrect. However, there is nothing much we can do within the current implementation. So, I propose we add something about this issue in the documentation and close it.
On the other hand, I think most of current issue can be solved by using annotate (http://matplotlib.sourceforge.net/users/annotations_guide.html#annotating-with-arrow).
@leejjoon I agree. I will open a PR with a note in the ax.arrow docstring. I think that should suffice.
Addressed in #1278.