Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d9357e

Browse files
committed
Merge pull request #6622 from data-exp-lab/strip-units-imshow
FIX: ensure masked array data is an ndarray
1 parent 1caf775 commit 8d9357e

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
@@ -947,7 +947,9 @@ def __call__(self, value, clip=None):
947947
result = ma.array(np.clip(result.filled(vmax), vmin, vmax),
948948
mask=mask)
949949
# ma division is very slow; we can take a shortcut
950-
resdat = result.data
950+
# use np.asarray so data passed in as an ndarray subclass are
951+
# interpreted as an ndarray. See issue #6622.
952+
resdat = np.asarray(result.data)
951953
resdat -= vmin
952954
resdat /= (vmax - vmin)
953955
result = np.ma.array(resdat, mask=result.mask, copy=False)

0 commit comments

Comments
 (0)