Skip to content

Commit 3b60c7c

Browse files
committed
Fix for case where no alpha is given.
1 parent db40193 commit 3b60c7c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/matplotlib/cm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,10 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True):
277277
x = self.norm(x)
278278

279279
try:
280-
alpha = ma.asarray(alpha)
281-
if alpha.ndim == 1 and alpha.shape == x.shape:
280+
np_alpha = ma.asarray(alpha)
281+
if np_alpha.ndim == 1 and np_alpha.shape == x.shape:
282282
rgba = self.cmap(x, bytes=bytes)
283-
rgba[0:, 3] = alpha
283+
rgba[0:, 3] = np_alpha
284284
return rgba
285285
except AttributeError:
286286
# e.g., alpha is not an array;

lib/matplotlib/collections.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,9 @@ def set_alpha(self, alpha):
680680
if alpha is not None:
681681
try:
682682
# Check if alpha is an array of matching size
683-
alpha = ma.asarray(alpha)
684-
if alpha.ndim == 1:
685-
artist.Artist.set_alpha(self, alpha)
683+
np_alpha = ma.asarray(alpha)
684+
if np_alpha.ndim == 1:
685+
artist.Artist.set_alpha(self, np_alpha)
686686
return
687687
except AttributeError:
688688
pass

0 commit comments

Comments
 (0)