diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index af5173d2503e..a2e5c3ad5d8a 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5928,10 +5928,7 @@ def _pcolorargs(self, funcname, *args, shading='auto', **kwargs): else: X, Y = np.meshgrid(np.arange(ncols + 1), np.arange(nrows + 1)) shading = 'flat' - C = cbook.safe_masked_invalid(C, copy=True) - return X, Y, C, shading - - if len(args) == 3: + elif len(args) == 3: # Check x and y for bad data... C = np.asanyarray(args[2]) # unit conversion allows e.g. datetime objects as axis values diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index ee6f715c3ccd..11490b605e22 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1499,6 +1499,20 @@ def test_pcolormesh_rgba(fig_test, fig_ref, dims, alpha): ax.pcolormesh(c[..., 0], cmap="gray", vmin=0, vmax=1, alpha=alpha) +@check_figures_equal(extensions=["png"]) +def test_pcolormesh_nearest_noargs(fig_test, fig_ref): + x = np.arange(4) + y = np.arange(7) + X, Y = np.meshgrid(x, y) + C = X + Y + + ax = fig_test.subplots() + ax.pcolormesh(C, shading="nearest") + + ax = fig_ref.subplots() + ax.pcolormesh(x, y, C, shading="nearest") + + @image_comparison(['pcolormesh_datetime_axis.png'], style='mpl20') def test_pcolormesh_datetime_axis(): # Remove this line when this test image is regenerated.