I tried the code you supplied and I didn't get it to work with the *angles*
keyword, I got:
"ValueError: shape mismatch: objects cannot be broadcast to a single shape"
I have matplotlib.__version__ = '0.98.5.2'.
Although after thinking about it for a while I did:
from scipy import *
import matplotlib.pyplot as plt
X,Y = meshgrid(arange(64),arange(64)) # a bit bigger just to see what it
looks like
angles = arange(0,4*pi,4.*pi/X.size) # just creating a set of angles
u = cos(angles)
v = sin(angles)
c = arange(u.size) # the colours!
c.shape = X.shape
plt.quiver(X, Y, u, v, c, pivot='middle',minlength=0.04, width=0.05,
headwidth=1,scale=50)
that is, the angles are converted to "u" and "v" parameters.
Anyway. That is how I got it working.
efiring wrote:
>
>
> Example with ipython -pylab:
>
> x = arange(4)
> y = arange(5)
> X, Y = meshgrid(x, y)
> u = ones_like(X)
> v = zeros_like(X)
> c = arange(u.size) # values mapped to colors
> angles = (X * 20 + Y * 20).ravel()
> quiver(X, Y, u, v, c, angles=angles)
> axis([-1, 4, -1, 5])
>
>
> The .ravel() of the angles is to get around a bug that I fixed a few
> minutes ago in svn.
>
> Eric
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
View this message in context: http://www.nabble.com/quiver-with-angles-tp25397027p25422103.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|