George Nurser wrote:
> I think there may be two bugs in quiver.
Thanks for the report. I can reproduce both problems, and I will try to
solve them.
Eric
>
> 1. Quiver doesn't seem to accept 1D arrays X and Y if they are
> different sizes -- they need to be turned into 2d arrays with meshgrid
> for the program to work. With line 13 uncommented I get the following
> error message:
>
> File "quivtest.py", line 13, in <module>
> ax.quiver(XT,YT,uu,vv) #fails
> File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py",
> line 5533, in quiver
> q = mquiver.Quiver(self, *args, **kw)
> File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/quiver.py",
> line 343, in __init__
> self.XY = np.hstack((X[:,np.newaxis], Y[:,np.newaxis]))
> File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/shape_base.py",
> line 488, in hstack
> return _nx.concatenate(map(atleast_1d,tup),1)
> ValueError: array dimensions must agree except for d_0
>
> 2. Masking is not working properly with quiver, while it works fine
> with contour -- see the attached quivtest.png
>
> quiver.py:
>
> import numpy as np
> import numpy.ma as ma
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as plt
> XT = np.arange(10.)
> YT = np.arange(20.)
> uu = np.zeros([20,10])+7.
> vv = np.zeros([20,10])+3.
>
> fig = plt.figure()
> ax = fig.add_subplot(121)
> # ax.quiver(XT,YT,uu,vv) #fails
> XX,YY = np.meshgrid(XT,YT)
> ax.quiver(XX,YY,uu,vv) #Ok
>
> ax = fig.add_subplot(122)
> msk = XX**2+YY**2 >50
> uumsk = ma.masked_array(uu,mask=msk)
> vvmsk = ma.masked_array(vv,mask=msk)
> ax.contour(XT,YT,uumsk*XX) # works
> ax.quiver(XX,YY,uumsk,vvmsk) # gives strange shapes
> plt.show()
> fig.savefig('quivtest.png',dpi=100)
>
> George Nurser.
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users