Skip to content

Commit 3e339a6

Browse files
authored
Merge pull request #27884 from rcomer/rbga-nan
FIX: don't copy twice on RGB input
2 parents 35c1dd2 + 8b98071 commit 3e339a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True):
362362
if xx.dtype.kind == 'f':
363363
# If any of R, G, B, or A is nan, set to 0
364364
if np.any(nans := np.isnan(x)):
365-
if xx.shape[2] == 4:
365+
if x.shape[2] == 4:
366366
xx = xx.copy()
367367
xx[np.any(nans, axis=2), :] = 0
368368

0 commit comments

Comments
 (0)