Thanks to visit codestin.com
Credit goes to github.com

Skip to content

quiver(C=...) argument is not reasonably validated #14060

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
sharun-s opened this issue Apr 26, 2019 · 3 comments · Fixed by #14424
Closed

quiver(C=...) argument is not reasonably validated #14060

sharun-s opened this issue Apr 26, 2019 · 3 comments · Fixed by #14424

Comments

@sharun-s
Copy link

sharun-s commented Apr 26, 2019

Bug summary

Quiver plot issue matching key label color with arrow color

Code for reproduction

q=plt.quiver([1, 2,], [1, 1], [[49],[49]], [0],
   [[(0.6, 0.8, 0.5, 1.0 )],
    [(0.3, 0.1, 0.2, 1.0 )]],
       angles=[[45],[90]],
       )
plt.quiverkey(q, .5, .5, 7, r'vector2', labelcolor=(0.3, 0.1, .2, 1), labelpos='S', coordinates = 'figure')

Actual outcome

Figure_1

Expected outcome

The key label color and a vector are both set to (0.3, 0.1, .2, 1) but their colors are different.

Matplotlib version

  • Operating system: Ubuntu 18.04
  • Matplotlib version: 3.0.3
  • Matplotlib backend: TkAgg
  • Python version: 3.6
  • Jupyter version (if applicable):
  • Other libraries:

pip3 install matplotlib

@timhoffm
Copy link
Member

This is actually not an issue with quiverkey(labelcolor=...), as can be checked by setting the label color to 'red'. (0.3, 0.1, .2, 1) is a dark violet, and that's what the label color is.

The problem is that the C argument is not doing, what one might expect:

In [[(0.6, 0.8, 0.5, 1.0 )], [(0.3, 0.1, 0.2, 1.0 )]] the first two numbers 0.6, 0.8 are used to lookup the colors of the two arrows from the colormap (whose norm is in some way determined by all the numbers - didn't check exactly).

This is not a reasonable behavior - either we should raise an error with these inputs or support explicit colors in C. Either way the documentation must be improved as well.

@timhoffm timhoffm changed the title Matching Quiverkey label color with arrow color quiver(C=...) argument is not reasonably validated Apr 27, 2019
@ImportanceOfBeingErnest
Copy link
Member

xref https://stackoverflow.com/questions/55871552/matplotlib-quiver-plot-matching-key-label-color-with-arrow-color/

I think this is above all a documentation issue. It currently says for C

C : 1D or 2D array, sequence, optional
The arrow colors

and for color

color : [ color | color sequence ], optional
This is a synonym for the PolyCollection facecolor kwarg. If C has been set, color has no effect.

@anntzer
Copy link
Contributor

anntzer commented Apr 28, 2019

Looks like a duplicate/variant of #13423, perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants