2010/11/1 Timothy W. Hilton <hil...@meteo.psu.edu>: > [...] > > I want to have blue water, some other (bright) color for missing data, > and a nice-looking color transition (matplotlib.cm.Blues or something > similar) for the valid data over land (values from 0 to 50). The > Cookbook example at > <http://www.scipy.org/Cookbook/Matplotlib/Plotting_Images_with_Special_Values> > addresses my problem, but I cannot get it to work. After changing > instances of matplotlib.numerix to numpy, I get a long list of > exceptions, the last of which is > TypeError: __call__() got an unexpected keyword argument 'bytes'. > This has to do with sentinelNorm, I think, but I'm not sure how to fix it.
I think I would tackle this by writing a Norm that doesn't change negative values, and you might mask then the oceans by -0.5, and the nans by -1.5. Then, you might create a colormap comprised of the ocean color for [-1, 0] and the nan color for [-2, -1], and for the normal normed range [0, 1] the normal Blues cm. Have a look at cm.py and _cm.py how it works. Basically, you can specify for all sections of the colormap the left and right color. So you can mix discrete maps with continuous ones, because the continuous ones are just linearly interpolated with matching colors for left/right at each boundary position. Looking at the code will clarify things a lot I believe. I don't know what went wrong with the cb example you said. From a quick look, it seems to have "sentinel rgb values", but this is not what we want, right? > Eventually I would like to sub-classify missing data by the type of > missing input that caused a missing value, but for now a single > missing data color is enough. That would be possible with the approach above, by just adding sections below zero. _cm.py: Definitions of colormaps, like Blues. cm.py: among other things, how to load such specifications. colors.py: Defines Colormaps, and Norms. Have a look at both of them, esp. at :class:`Normalize`. I would subclass the Norm mentioned above from Normalize. I hope this helps you, Friedrich ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users