Skip to content

Commit 5c6f81d

Browse files
committed
Merged revisions 8931 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint ........ r8931 | weathergod | 2011-01-21 15:42:45 -0600 (Fri, 21 Jan 2011) | 3 lines 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! ........ svn path=/trunk/matplotlib/; revision=8932
1 parent 41543cd commit 5c6f81d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/matplotlib/colors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ def __call__(self, X, alpha=None, bytes=False):
523523
np.clip(xa * self.N, -1, self.N, out=xa)
524524
else:
525525
xa = np.clip(xa * self.N, -1, self.N)
526+
527+
# ensure that all 'under' values will still have negative
528+
# value after casting to int
529+
np.putmask(xa, xa<0.0, -1)
526530
xa = xa.astype(int)
527531
# Set the over-range indices before the under-range;
528532
# otherwise the under-range values get converted to over-range.

0 commit comments

Comments
 (0)