specifying NaN color when using imshow

Hello, I'm trying to plot some grid data using basemap and

    > imshow however haven't figured out how to specify the
    > color for nan values. For example, in my data, valid
    > values range from 0.0-10.0. I've assigned -9999.0 and
    > 1e30 to the missing values and when I imshow (setting
    > vmin=0.0, vmax=10.0), the missing values show up in the
    > low and high end of the spectrum, respectively. Is there
    > a way to do this?

See the archives for a post by Danny Shevitz and followups in the
thread "obscure colormapping issue related to quantization"

http://article.gmane.org/gmane.comp.python.matplotlib.general/2856/match=obscure+colormapping+issue+related+to+quantization

Basically, you want to write a custom normalization and colormapping
instance, and recipe code is posted in the thread linked above.

JDH

I just got back from vacation sorry for the delay.

If you haven't worked out your own solution yet, I took John's suggestions and made some very minor additions to them. If you are interested, I can post the resulting code which allows you to specify a base colormap and then override arbitrary sentinels with specified colors.

One problem with John's algorithm as written in his original post, was that the sentinel was included in the normalization and should not be.

D

···

At 09:21 PM 11/25/2005 -0600, you wrote:

>>>>> "Gerald" == Gerald John M Manipon <Geraldjohn.M.Manipon@...369...> writes:

    > Hello, I'm trying to plot some grid data using basemap and
    > imshow however haven't figured out how to specify the
    > color for nan values. For example, in my data, valid
    > values range from 0.0-10.0. I've assigned -9999.0 and
    > 1e30 to the missing values and when I imshow (setting
    > vmin=0.0, vmax=10.0), the missing values show up in the
    > low and high end of the spectrum, respectively. Is there
    > a way to do this?

See the archives for a post by Danny Shevitz and followups in the
thread "obscure colormapping issue related to quantization"

http://article.gmane.org/gmane.comp.python.matplotlib.general/2856/match=obscure+colormapping+issue+related+to+quantization

Basically, you want to write a custom normalization and colormapping
instance, and recipe code is posted in the thread linked above.

JDH

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users