Revision: 8931 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8931&view=rev Author: weathergod Date: 2011-01-21 21:42:45 +0000 (Fri, 21 Jan 2011)
Log Message: ----------- Fixes colors normalization with 'under' colors in LinearSegmentedColormap (values between -1 and 0 were being made positive due to an int cast). Thanks to Eoghan Harrington for discovering and supplying the patch! Modified Paths: -------------- branches/v1_0_maint/lib/matplotlib/colors.py Modified: branches/v1_0_maint/lib/matplotlib/colors.py =================================================================== --- branches/v1_0_maint/lib/matplotlib/colors.py 2011-01-21 20:38:54 UTC (rev 8930) +++ branches/v1_0_maint/lib/matplotlib/colors.py 2011-01-21 21:42:45 UTC (rev 8931) @@ -523,6 +523,10 @@ np.clip(xa * self.N, -1, self.N, out=xa) else: xa = np.clip(xa * self.N, -1, self.N) + + # ensure that all 'under' values will still have negative + # value after casting to int + np.putmask(xa, xa<0.0, -1) xa = xa.astype(int) # Set the over-range indices before the under-range; # otherwise the under-range values get converted to over-range. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ 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-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins