From: Gerald J. M. M. <Ger...@jp...> - 2005-11-22 23:04:33
|
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? Thanks, Gerald |
From: John H. <jdh...@ac...> - 2005-11-26 03:27:00
|
>>>>> "Gerald" == Gerald John M Manipon <Ger...@jp...> writes: Gerald> Hello, I'm trying to plot some grid data using basemap and Gerald> imshow however haven't figured out how to specify the Gerald> color for nan values. For example, in my data, valid Gerald> values range from 0.0-10.0. I've assigned -9999.0 and Gerald> 1e30 to the missing values and when I imshow (setting Gerald> vmin=0.0, vmax=10.0), the missing values show up in the Gerald> low and high end of the spectrum, respectively. Is there Gerald> 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 |
From: Danny S. <sh...@la...> - 2005-11-28 16:54:12
|
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 > <Ger...@jp...> writes: > > Gerald> Hello, I'm trying to plot some grid data using basemap and > Gerald> imshow however haven't figured out how to specify the > Gerald> color for nan values. For example, in my data, valid > Gerald> values range from 0.0-10.0. I've assigned -9999.0 and > Gerald> 1e30 to the missing values and when I imshow (setting > Gerald> vmin=0.0, vmax=10.0), the missing values show up in the > Gerald> low and high end of the spectrum, respectively. Is there > Gerald> 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 >Mat...@li... >https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: John H. <jdh...@ac...> - 2005-11-28 17:16:54
|
>>>>> "Danny" == Danny Shevitz <sh...@la...> writes: Danny> I just got back from vacation sorry for the delay. If you Danny> haven't worked out your own solution yet, I took John's Danny> suggestions and made some very minor additions to them. If Danny> you are interested, I can post the resulting code which Danny> allows you to specify a base colormap and then override Danny> arbitrary sentinels with specified colors. Danny> One problem with John's algorithm as written in his Danny> original post, was that the sentinel was included in the Danny> normalization and should not be. I think this would make a nice wiki entry if you get the time. http://www.scipy.org/wikis/topical_software/MatplotlibCookbook JDH |
From: Eric F. <ef...@ha...> - 2005-11-28 17:25:58
|
John, I think that the changes I made in CVS over the weekend provide a much easier way to do this, as illustrated in the new examples/image_masked.py. Eric John Hunter wrote: >>>>>>"Danny" == Danny Shevitz <sh...@la...> writes: > > > Danny> I just got back from vacation sorry for the delay. If you > Danny> haven't worked out your own solution yet, I took John's > Danny> suggestions and made some very minor additions to them. If > Danny> you are interested, I can post the resulting code which > Danny> allows you to specify a base colormap and then override > Danny> arbitrary sentinels with specified colors. > > Danny> One problem with John's algorithm as written in his > Danny> original post, was that the sentinel was included in the > Danny> normalization and should not be. > > I think this would make a nice wiki entry if you get the time. > > http://www.scipy.org/wikis/topical_software/MatplotlibCookbook > > > > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Danny S. <sh...@la...> - 2005-11-30 16:41:15
|
I added a Wiki entry entitled "Plotting images with special values". It shows my current incarnation of how to plot images with special values mapped to specified colors. The user can plot arbitrary numbers of special values. Danny |