I'm using the code
import matplotlib.pyplot as plt
plt.figure(1)
plt.axis(xmin=0, xmax=60, ymin=0, ymax=0.25)
plt.arrow(30, 0.01, 10, 0.1, head_width=0.05, head_length=1, length_includes_head=True)
plt.savefig('arrow.png')
and I expect to get an arrowhead that is pointing in the same direction the line of the arrow points. But it doesn't:

What can be done about this (and why is it happening?)
Part of the reason has been briefly mentioned here as:
Notes
The resulting arrow is affected by the axes aspect ratio and limits. This may produce an arrow whose head is not square with its stem. To create an arrow whose head is square with its stem, use annotate() for example:
Do you mind doing this?
import matplotlib.pyplot as plt
plt.figure(1)
plt.axis(xmin=0, xmax=60, ymin=0, ymax=0.25)
# plt.arrow(30, 0.01, 10, 0.1, head_width=0.05, head_length=1, length_includes_head=True)
plt.annotate("", xy=(40, 0.11), xytext=(30, 0.01), arrowprops=dict(headwidth=10, headlength=10, width=0.1))
plt.savefig('arrow.png')

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With