Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

plt.arrow start and end locations are wrong #12768

Open
Labels
@Austrianguy

Description

@Austrianguy

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).

printscreen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp