Skip to content

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

Closed

Description

@EdwinChan

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

Activity

  1. added this to the milestone on Dec 3, 2015
  2. self-assigned this
    on Dec 3, 2015
  3. efiring commented on Dec 3, 2015

    @efiring
    Member

    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.

  4. tacaswell commented on Dec 4, 2015

    @tacaswell
    Member

    I do not see how I broke this 😞

  5. efiring commented on Dec 4, 2015

    @efiring
    Member

    @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".

  6. tacaswell commented on Dec 4, 2015

    @tacaswell
    Member

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

  7. efiring commented on Dec 5, 2015

    @efiring
    Member

    OK, thanks.

  8. added a commit that references this issue on Dec 5, 2015
    34d601f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions