Skip to content
Draft
Show file tree
Hide file tree
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: 5 additions & 8 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down