Skip to content

Commit 616be00

Browse files
author
Yi Wei
committed
FIX: pcolormesh writing to read-only input mask
1 parent 3405fa7 commit 616be00

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/matplotlib/axes/_axes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5764,7 +5764,7 @@ def _pcolorargs(self, funcname, *args, shading='auto', **kwargs):
57645764
else:
57655765
X, Y = np.meshgrid(np.arange(ncols + 1), np.arange(nrows + 1))
57665766
shading = 'flat'
5767-
C = cbook.safe_masked_invalid(C)
5767+
C = cbook.safe_masked_invalid(C, copy=True)
57685768
return X, Y, C, shading
57695769

57705770
if len(args) == 3:
@@ -5853,7 +5853,7 @@ def _interp_grid(X):
58535853
Y = _interp_grid(Y.T).T
58545854
shading = 'flat'
58555855

5856-
C = cbook.safe_masked_invalid(C)
5856+
C = cbook.safe_masked_invalid(C, copy=True)
58575857
return X, Y, C, shading
58585858

58595859
@_preprocess_data()

lib/matplotlib/cbook.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def remove(self, o):
668668
self.push(elem)
669669

670670

671-
def safe_masked_invalid(x, copy=True):
671+
def safe_masked_invalid(x, copy=False):
672672
x = np.array(x, subok=True, copy=copy)
673673
if not x.dtype.isnative:
674674
# If we have already made a copy, do the byteswap in place, else make a

0 commit comments

Comments
 (0)