Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug report
Bug summary
When I draw an arrow from a point(x, y)
with offset(dx, dy)
, then I expect the arrow to start at (x, y) and point to(x+dx, y+dy)
. But that's not what happens.
Code for reproduction
importmatplotlib.pyplotaspltplt.text(0,2.1,'head_starts_at_zero=False')plt.arrow(0,2,1,0,head_width=0.05,head_starts_at_zero=False)plt.arrow(0,1,1,0,head_width=0.05,head_starts_at_zero=True)plt.text(0,0.8,'head_starts_at_zero=True')plt.vlines([0,1],0,3)plt.axis([-1,2,0,3])
Actual outcome
Withhead_starts_at_zero=False
the arrow is longer than specified by thehead_length
(possibly intended)
Withhead_starts_at_zero=True
the arrow is the same length as before but moved along its direction by an arbitrary distance (possibly thehead_width
).
Expected outcome
The default option should be to have the arrow start from the start coordinates and the arrow tip ending at the end coordinates. It might be nice to also have the option where the base of the arrow is at the end coordinates and the arrow head goes further (like the upper example in the plot).
Besides this feature working wrong, the documentation is unclear, which made it hard for me to find this bug:
head_starts_at_zero: bool (default: False)
if True, the head starts being drawn at coordinate 0 instead of ending at coordinate 0.
What's "coordinate 0" here?
Might be better to write:
head_starts_at_zero: bool (default: False)
if True, the head starts being drawn at the specified end point instead of ending at the end point.
if that's the intended behaviour.
Matplotlib version
- Operating system: Windows 10
- Matplotlib version: 2.2.3
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg - Python version: 2.7
- Jupyter version (if applicable): ---
- Other libraries: ---
Environment built from the Anaconda default channel.