Skip to content Skip to sidebar Skip to footer

Matplotlib.patches.fancyarrow Has Thinned Out Tail

When I execute this code: plt.figure(figsize=(3,3)) plt.xlim(-3, 3); plt.ylim(-3,3); plt.arrow(0,0, 2, 2, head_length=1.4, head_width=1.8, width=1.4, alpha=0.2, length_includes

Solution 1:

This seems to be some kind of bug in the arrow. You would expect there to be a tail_width argument which sets the width of the arrow (or its tail). This however does not exist.

As a workaround, you may use a FancyArrowPatch which you need to manually add to the axes. The FancyArrowPatch has an argument arrowstyle to which you can supply a string of arguments. Within this string "tail_width" is correctly recognized.

import matplotlib.pyplotas plt
import matplotlib.patchesas patches

plt.figure(figsize=(3,3))
plt.xlim(-3, 3); plt.ylim(-3,3);

style="Simple,head_length=28,head_width=36,tail_width=20"
plt.gca().add_patch(
        patches.FancyArrowPatch((0,0), (2,2),arrowstyle=style,alpha=0.2,fc='r' ))

plt.show()

enter image description here

Post a Comment for "Matplotlib.patches.fancyarrow Has Thinned Out Tail"