File tree 3 files changed +9
-3
lines changed 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -731,8 +731,7 @@ def safe_masked_invalid(x, copy=False):
731
731
# copy with the byte order swapped.
732
732
x = x .byteswap (inplace = copy ).newbyteorder ('N' ) # Swap to native order.
733
733
try :
734
- xm = np .ma .masked_invalid (x , copy = False )
735
- xm .shrink_mask ()
734
+ xm = np .ma .masked_where (~ (np .isfinite (x )), x , copy = False )
736
735
except TypeError :
737
736
return x
738
737
return xm
Original file line number Diff line number Diff line change @@ -735,5 +735,6 @@ def _ensure_cmap(cmap):
735
735
cmap_name = cmap if cmap is not None else mpl .rcParams ["image.cmap" ]
736
736
# use check_in_list to ensure type stability of the exception raised by
737
737
# the internal usage of this (ValueError vs KeyError)
738
- _api .check_in_list (sorted (_colormaps ), cmap = cmap_name )
738
+ if cmap_name not in _colormaps :
739
+ _api .check_in_list (sorted (_colormaps ), cmap = cmap_name )
739
740
return mpl .colormaps [cmap_name ]
Original file line number Diff line number Diff line change @@ -1390,6 +1390,12 @@ def autoscale(self, A):
1390
1390
def autoscale_None (self , A ):
1391
1391
"""If vmin or vmax are not set, use the min/max of *A* to set them."""
1392
1392
A = np .asanyarray (A )
1393
+
1394
+ if isinstance (A , np .ma .MaskedArray ):
1395
+ # we need to make the distinction between an array, False, np.bool_(False)
1396
+ if A .mask is False or not A .mask .shape :
1397
+ A = A .data
1398
+
1393
1399
if self .vmin is None and A .size :
1394
1400
self .vmin = A .min ()
1395
1401
if self .vmax is None and A .size :
You can’t perform that action at this time.
0 commit comments