Skip to content

Quiverkey() positions arrow incorrectly with labelpos 'N' or 'S' #5613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
EdwinChan opened this issue Dec 3, 2015 · 5 comments · Fixed by #5620
Closed

Quiverkey() positions arrow incorrectly with labelpos 'N' or 'S' #5613

EdwinChan opened this issue Dec 3, 2015 · 5 comments · Fixed by #5620
Assignees
Milestone

Comments

@EdwinChan
Copy link

The documentation for quiverkey() in versions 1.3 through 1.5 states that

If labelpos is 'N' or 'S', X, Y give the position of the middle of the key arrow.

This guarantee is clearly violated in version 1.5:

quiver_1 4 3
quiver_1 5 0
quiver_1 5 0 548 g9230cac

The script that generated these figures is

import numpy
import matplotlib
from matplotlib import pyplot

plot = pyplot.quiver(*numpy.random.rand(2, 10, 10))
pyplot.xlim(-2, 12)
pyplot.ylim(-2, 12)
pyplot.quiverkey(plot, 0.5, 1, 1, 'N', labelpos='N')
pyplot.quiverkey(plot, 1, 0.5, 1, 'E', labelpos='E')
pyplot.quiverkey(plot, 0.5, 0, 1, 'S', labelpos='S')
pyplot.quiverkey(plot, 0, 0.5, 1, 'W', labelpos='W')
pyplot.annotate(matplotlib.__version__, (0, 0), (-1, 11), 'data', 'data',
  ha='left')
pyplot.savefig('quiver_{}.png'.format(matplotlib.__version__))
@mdboom mdboom added this to the Critical bugfix release (1.5.1) milestone Dec 3, 2015
@efiring efiring self-assigned this Dec 3, 2015
@efiring
Copy link
Member

efiring commented Dec 3, 2015

I see what happened (in #3955), and it's easy to fix. I can do it today or tomorrow. Thanks for the report, @EdwinChan. Your script will inspire a test.

@tacaswell
Copy link
Member

I do not see how I broke this 😞

@efiring
Copy link
Member

efiring commented Dec 4, 2015

@tacaswell, You normalized to "middle", but quiverkey is still using "mid" and is not going through the normalization (and indeed, it shouldn't need to). So I will either change the normalization to "mid", or change quiverkey to request "middle".

@tacaswell
Copy link
Member

Ah, I see. I can clean up my mess if you would like.

@efiring
Copy link
Member

efiring commented Dec 5, 2015

OK, thanks.

tacaswell added a commit to tacaswell/matplotlib that referenced this issue Dec 5, 2015
In PR matplotlib#3955 / af17051 the quiver pivot
location was normalized to be 'tip', 'tail', or 'middle' internally.
The key 'mid' is now normalized to 'middle'.  The quiver key code
circumvents the normalization and was setting `Quiver.pivot' to 'mid',
which fell back to the default behavior of pivoting on the tail when the
quiver key is drawn.

closes matplotlib#5613
@tacaswell tacaswell assigned tacaswell and unassigned efiring Dec 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants