Skip to content

Commit f8ea2c5

Browse files
authored
Merge pull request #6622 from data-exp-lab/strip-units-imshow
FIX: ensure masked array data is an ndarray
2 parents e11f2b9 + 6c9f8a9 commit f8ea2c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/colors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,9 @@ def __call__(self, value, clip=None):
925925
result = np.ma.array(np.clip(result.filled(vmax), vmin, vmax),
926926
mask=mask)
927927
# ma division is very slow; we can take a shortcut
928-
resdat = result.data
928+
# use np.asarray so data passed in as an ndarray subclass are
929+
# interpreted as an ndarray. See issue #6622.
930+
resdat = np.asarray(result.data)
929931
resdat -= vmin
930932
resdat /= (vmax - vmin)
931933
result = np.ma.array(resdat, mask=result.mask, copy=False)

0 commit comments

Comments
 (0)