diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 5441b0d617b5..16e13e69d53f 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -1302,9 +1302,8 @@ def process_value(value): dtype = np.promote_types(dtype, np.float32) # ensure data passed in as an ndarray subclass are interpreted as # an ndarray. See issue #6622. - mask = np.ma.getmask(value) - data = np.asarray(value) - result = np.ma.array(data, mask=mask, dtype=dtype, copy=True) + result = np.ma.array(np.asarray(value), mask=np.ma.getmaskarray(value), + dtype=dtype, copy=True) return result, is_scalar def __call__(self, value, clip=None): @@ -1341,9 +1340,8 @@ def __call__(self, value, clip=None): raise ValueError("minvalue must be less than or equal to maxvalue") else: if clip: - mask = np.ma.getmask(result) result = np.ma.array(np.clip(result.filled(vmax), vmin, vmax), - mask=mask) + mask=np.ma.getmaskarray(result)) # ma division is very slow; we can take a shortcut resdat = result.data resdat -= vmin @@ -1459,7 +1457,7 @@ def __call__(self, value, clip=None): result = np.ma.masked_array( np.interp(result, [self.vmin, self.vcenter, self.vmax], [0, 0.5, 1], left=-np.inf, right=np.inf), - mask=np.ma.getmask(result)) + mask=np.ma.getmaskarray(result)) if is_scalar: result = np.atleast_1d(result)[0] return result @@ -1873,9 +1871,8 @@ def __call__(self, value, clip=None): result.fill(0) else: if clip: - mask = np.ma.getmask(result) result = np.ma.array(np.clip(result.filled(vmax), vmin, vmax), - mask=mask) + mask=np.ma.getmaskarray(result)) resdat = result.data resdat -= vmin resdat[resdat < 0] = 0 diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 1471d4fe672d..62d460a9833c 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -1849,7 +1849,7 @@ def transform_affine(self, points): mtx = self.get_matrix() if isinstance(points, np.ma.MaskedArray): tpoints = affine_transform(points.data, mtx) - return np.ma.MaskedArray(tpoints, mask=np.ma.getmask(points)) + return np.ma.MaskedArray(tpoints, mask=np.ma.getmaskarray(points)) return affine_transform(points, mtx) if DEBUG: