Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e2b86f

Browse files
committed
Fixed incorrect bug fix in ScalarMappable.to_rgba()
svn path=/trunk/matplotlib/; revision=2073
1 parent 23a7187 commit 1e2b86f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2006-02-22 Fixed bug in ScalarMappable.to_rgba() reported by
2+
Ray Jones, and fixed incorrect fix found by Jeff
3+
Whitaker - EF
4+
15
===============================================================
26
2006-02-22 Released 0.87
37

lib/matplotlib/cm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ def set_colorbar(self, im, ax):
4848
self.colorbar = im, ax
4949

5050
def to_rgba(self, x, alpha=1.0):
51-
# assume normalized rgb, rgba
52-
if len(x.shape)>2: return x
51+
'''Return a normalized rgba array corresponding to x.
52+
If x is already an rgb or rgba array, return it unchanged.
53+
'''
54+
if hasattr(x, 'shape') and len(x.shape)>2: return x
5355
x = ma.asarray(x)
5456
x = self.norm(x)
5557
x = self.cmap(x, alpha)

0 commit comments

Comments
 (0)