Skip to content

Define autoscale() based on autoscale_None(). #24460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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
Expand Down