8000 Make pcolor preserve all data · matplotlib/matplotlib@fdd589e · GitHub
[go: up one dir, main page]

Skip to content

Commit fdd589e

Browse files
committed
Make pcolor preserve all data
1 parent 5ec0e25 commit fdd589e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5273,7 +5273,19 @@ def _pcolorargs(funcname, *args, **kw):
52735273
raise TypeError('Dimensions of C %s are incompatible with'
52745274
' X (%d) and/or Y (%d); see help(%s)' % (
52755275
C.shape, Nx, Ny, funcname))
5276-
C = C[:Ny - 1, :Nx - 1]
5276+
X = np.hstack( (1.5 * X[:, [0]] - 0.5 * X[:, [1]],
5277+
0.5 * (X[:, 1:] + X[:, :-1]),
5278+
1.5 * X[:, [-1]] - 0.5 * X[:, [-2]]) )
5279+
X = np.vstack( (1.5 * X[[0], :] - 0.5 * X[[1], :],
5280+
0.5 * (X[1:, :] + X[:-1, :]),
5281+
1.5 * X[[-1], :] - 0.5 * X[[-2], :]) )
5282+
Y = np.vstack( (1.5 * Y[[0], :] - 0.5 * Y[[1], :],
5283+
0.5 * (Y[1:, :] + Y[:-1, :]),
5284+
1.5 * Y[[-1], :] - 0.5 * Y[[-2], :]) )
5285+
Y = np.hstack( (1.5 * Y[:, [0]] - 0.5 * Y[:, [1]],
5286+
0.5 * (Y[:, 1:] + Y[:, :-1]),
5287+
1.5 * Y[:, [-1]] - 0.5 * Y[:, [-2]]) )
5288+
52775289
C = cbook.safe_masked_invalid(C)
52785290
return X, Y, C
52795291

0 commit comments

Comments
 (0)
0