quiver , contourf , nans

Dear all,

I have to quiver(x,y,u,v) , where u,v are displacement vectors and x,y their position.
I also have to contourf(x,y,u)

u and v have some nan elements. how does matplotlib handle nans because it returns this error:

ValueError: math domain error

Thanks

Dwishen

Support for nan in inputs to matplotlib is presently spotty (and mostly accidental); use masked arrays instead. Masked arrays have been supported by contourf for a long time, but I added masked array support to quiver (and only for u and v, not for x and y) only very recently, so until a new release is made (probably very soon) it will be available only in svn.

To make a masked array from your array with nans, do something like this:

import pylab as P
um = P.nx.ma.masked_where(P.nx.isnan(u), u)

It might make sense to have matplotlib argument handling code do this automatically on all arguments that can be masked arrays, but unless or until we make that change, you will have to to it manually as needed.

Eric

Dwishen Ramanah wrote:

ยทยทยท

Dear all,

I have to quiver(x,y,u,v) , where u,v are displacement vectors and x,y their position.
I also have to contourf(x,y,u)

u and v have some nan elements. how does matplotlib handle nans because it returns this error:

ValueError: math domain error

Thanks

Dwishen

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users