From 3ac96eb903de2adf1a9701e1d4abeeb9a85162d6 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 25 Oct 2022 14:23:13 +0200 Subject: [PATCH] Define autoscale() based on autoscale_None(). They're the same if autoscale() first resets vmin/vmax to None. This ensures e.g. that the exact semantics of fully invalid arrays (in_trf_range is empty) for make_norm_from_scale are consistent between the two methods. --- lib/matplotlib/colors.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 1b159329deac..0313565a2583 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -1371,9 +1371,8 @@ def inverse(self, value): def autoscale(self, A): """Set *vmin*, *vmax* to min, max of *A*.""" - A = np.asanyarray(A) - self.vmin = A.min() - self.vmax = A.max() + self.vmin = self.vmax = None + self.autoscale_None(A) def autoscale_None(self, A): """If vmin or vmax are not set, use the min/max of *A* to set them.""" @@ -1715,14 +1714,8 @@ def inverse(self, value): .reshape(np.shape(value))) return value[0] if is_scalar else value - def autoscale(self, A): - # i.e. A[np.isfinite(...)], but also for non-array A's - in_trf_domain = np.extract(np.isfinite(self._trf.transform(A)), A) - if in_trf_domain.size == 0: - in_trf_domain = np.ma.masked - return super().autoscale(in_trf_domain) - def autoscale_None(self, A): + # i.e. A[np.isfinite(...)], but also for non-array A's in_trf_domain = np.extract(np.isfinite(self._trf.transform(A)), A) if in_trf_domain.size == 0: in_trf_domain = np.ma.masked pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy