|
From: <wea...@us...> - 2011-01-21 21:42:52
|
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.
|