File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
Expand file tree Collapse file tree 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):
731731 # copy with the byte order swapped.
732732 x = x .byteswap (inplace = copy ).newbyteorder ('N' ) # Swap to native order.
733733 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 )
736735 except TypeError :
737736 return x
738737 return xm
Original file line number Diff line number Diff line change @@ -735,5 +735,6 @@ def _ensure_cmap(cmap):
735735 cmap_name = cmap if cmap is not None else mpl .rcParams ["image.cmap" ]
736736 # use check_in_list to ensure type stability of the exception raised by
737737 # 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 )
739740 return mpl .colormaps [cmap_name ]
Original file line number Diff line number Diff line change @@ -1390,6 +1390,12 @@ def autoscale(self, A):
13901390 def autoscale_None (self , A ):
13911391 """If vmin or vmax are not set, use the min/max of *A* to set them."""
13921392 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+
13931399 if self .vmin is None and A .size :
13941400 self .vmin = A .min ()
13951401 if self .vmax is None and A .size :
You can’t perform that action at this time.
0 commit comments