From 8b98071871c7bbc5da692e51a74fabcfba3f0d72 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Fri, 8 Mar 2024 04:22:25 +0000 Subject: [PATCH] FIX: don't copy twice on RGB input --- lib/matplotlib/cm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/cm.py b/lib/matplotlib/cm.py index e9a7aad6c456..c14973560ac3 100644 --- a/lib/matplotlib/cm.py +++ b/lib/matplotlib/cm.py @@ -362,7 +362,7 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True): if xx.dtype.kind == 'f': # If any of R, G, B, or A is nan, set to 0 if np.any(nans := np.isnan(x)): - if xx.shape[2] == 4: + if x.shape[2] == 4: xx = xx.copy() xx[np.any(nans, axis=2), :] = 0
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: