Skip to content

Commit 5ac32f3

Browse files
committed
Merge pull request matplotlib#5451 from andim/pcolormesh-nan-handling
[Bug] masking of NaN Z values in pcolormesh
2 parents 57d1343 + 8928311 commit 5ac32f3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4983,6 +4983,7 @@ def _pcolorargs(funcname, *args, **kw):
49834983
else:
49844984
X, Y = np.meshgrid(np.arange(numCols + 1),
49854985
np.arange(numRows + 1))
4986+
C = cbook.safe_masked_invalid(C)
49864987
return X, Y, C
49874988

49884989
if len(args) == 3:
@@ -5015,6 +5016,7 @@ def _pcolorargs(funcname, *args, **kw):
50155016
' X (%d) and/or Y (%d); see help(%s)' % (
50165017
C.shape, Nx, Ny, funcname))
50175018
C = C[:Ny - 1, :Nx - 1]
5019+
C = cbook.safe_masked_invalid(C)
50185020
return X, Y, C
50195021

50205022
@unpack_labeled_data(label_namer=None)

0 commit comments

Comments
 (0)