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

Skip to content

Commit 5c946bb

Browse files
authored
Merge pull request #29209 from jklymak/fix-pcolormesh-nearest-noargs
FIX: pcolormesh with no x y args and nearest interp
2 parents 690c55f + 54d7b91 commit 5c946bb

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5923,10 +5923,7 @@ def _pcolorargs(self, funcname, *args, shading='auto', **kwargs):
59235923
else:
59245924
X, Y = np.meshgrid(np.arange(ncols + 1), np.arange(nrows + 1))
59255925
shading = 'flat'
5926-
C = cbook.safe_masked_invalid(C, copy=True)
5927-
return X, Y, C, shading
5928-
5929-
if len(args) == 3:
5926+
elif len(args) == 3:
59305927
# Check x and y for bad data...
59315928
C = np.asanyarray(args[2])
59325929
# unit conversion allows e.g. datetime objects as axis values

lib/matplotlib/tests/test_axes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,20 @@ def test_pcolormesh_rgba(fig_test, fig_ref, dims, alpha):
14991499
ax.pcolormesh(c[..., 0], cmap="gray", vmin=0, vmax=1, alpha=alpha)
15001500

15011501

1502+
@check_figures_equal(extensions=["png"])
1503+
def test_pcolormesh_nearest_noargs(fig_test, fig_ref):
1504+
x = np.arange(4)
1505+
y = np.arange(7)
1506+
X, Y = np.meshgrid(x, y)
1507+
C = X + Y
1508+
1509+
ax = fig_test.subplots()
1510+
ax.pcolormesh(C, shading="nearest")
1511+
1512+
ax = fig_ref.subplots()
1513+
ax.pcolormesh(x, y, C, shading="nearest")
1514+
1515+
15021516
@image_comparison(['pcolormesh_datetime_axis.png'], style='mpl20')
15031517
def test_pcolormesh_datetime_axis():
15041518
# Remove this line when this test image is regenerated.

0 commit comments

Comments
 (0)