-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
quiver problems when angles is an array of values rather than 'uv' or 'xy' #6970
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
Comments
What does |
and can you provide a minimal working example? |
The version of matplotlib is 1.5.1 and here is the code I used. The commented out line works fine, except it does not have the desired angles.
|
This is still not minimal example, I meant something more like import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
X, Y = np.meshgrid(np.arange(15), np.arange(10))
U = V = np.ones_like(X)
phi = (np.random.rand(15, 10) - .5) * 150
ax.quiver(X, Y, U, V, angles=phi) which is sufficient to show the problem, is understandable, and (most importantly) is copy-paste-runnable. |
and I have a fix for this, just adding a test. |
@mlandriau Can you open a new issue for the quiverkey? It is not drawing a half-circle, it is drawing an arrow for each angle import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
X, Y = np.meshgrid(np.arange(5), np.arange(7))
U = V = np.ones_like(X)
phi = (np.random.rand(5, 7) - .5) * 150
q = ax.quiver(X, Y, U, V*.5, angles=phi, color='r', alpha=1)
qk = ax.quiverkey(q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$',
labelpos='W',
fontproperties={'weight': 'bold'}) |
Do not try to compare a string to an array. closes matplotlib#6970
Thanks, I've opened a new issue using the test code in your comment with one line added. |
I use the version of matplotlib that is included in the following distribution:
Python 3.5.2 |Anaconda 4.1.1 (x86_64)| (default, Jul 2 2016, 17:52:12)
IPython 4.2.0 -- An enhanced Interactive Python.
quiver produces the following warnings when called with angles=array :
/Users/mlandriau/anaconda/lib/python3.5/site-packages/matplotlib/quiver.py:609: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self.angles == 'xy' and self.scale_units == 'xy':
/Users/mlandriau/anaconda/lib/python3.5/site-packages/matplotlib/quiver.py:614: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
elif self.angles == 'xy' or self.scale_units == 'xy':
/Users/mlandriau/anaconda/lib/python3.5/site-packages/matplotlib/quiver.py:647: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self.angles == 'xy':
/Users/mlandriau/anaconda/lib/python3.5/site-packages/matplotlib/quiver.py:649: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
elif self.angles == 'uv':
It seems to produce the right answer, except quiverkey no longer works properly (the arrow is a filled half-circle instead of a line).
The text was updated successfully, but these errors were encountered: