Hi, I noticed some erroneous behaviour when using a LinearSegmentedColormap with an "under" color and different numbers of color levels. The attached script replicates the behaviour, whereby lowering the number of colors causes less of the values to be considered "under" the vmin. I tracked the problem back to the Colormap class where the results of Normalize are multiplied by the number of color levels (N) and casted as an int to be used as indices in the color array. The expected behaviour would be that all negative values should be considered "under", however the results of the cast means that anything between 0 and -0.5 will be set to 0 and therefore will be in the normal color range for the colormap. The attached patch overcomes this by setting all negative values to -1 before applying the cast.
Thanks for your help, Eoghan
525a526 > np.putmask(xa, xa<0.0, -1) #ensure that all 'under' values will > have negative value when casting to int
<<attachment: cmap_bug_w_patch.png>>
<<attachment: cmap_bug_wo_patch.png>>
cmap_bug.py
Description: Binary data
------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel