On Tue, Feb 1, 2011 at 11:09 AM, Francesco Benincasa <
francesco.beninc...@bsc.es> wrote:

> Hi all,
>
> I'm using pygrads for plotting maps from netcdf files.
>
> I use the contourf method, but I'm not able to fill the region where there
> are
> no value (there is the missing value -999) with a color. It seems to ignore
> the set_bad method that I used to make the colormap.
>
> Any suggestions?
>
> Thank you very much in advance.
>
> --
> | Francesco Benincasa
>
>
Most likely, the issue is that set_bad is more for setting the color when
encountering masked values (through masked arrays).  As a quick and dirty
way to deal with it, try setting that color through the set_under() method.

The correct way to do this is to use set_bad, but convert  your numpy array
that you are displaying into a masked array like so:

z_ma = np.ma.masked_array(z, mask=(z == -999))

and use contourf on z_ma.

Let us know how that works for you.

Ben Root
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to