Skip to content

Commit 98dd012

Browse files
committed
fix for pcolormesh doesn't allow shading = 'flat' in the option
1 parent 8ed4c02 commit 98dd012

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5749,7 +5749,7 @@ def _pcolorargs(self, funcname, *args, shading='auto', **kwargs):
57495749
if shading == 'flat':
57505750
if (Nx, Ny) != (ncols + 1, nrows + 1):
57515751
raise TypeError('Dimensions of C %s are incompatible with'
5752-
' X (%d) and/or Y (%d); see help(%s)' % (
5752+
' X (%d) and/or Y (%d); X and y should be one larger than C see help(%s)' % (
57535753
C.shape, Nx, Ny, funcname))
57545754
else: # ['nearest', 'gouraud']:
57555755
if (Nx, Ny) != (ncols, nrows):

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,13 @@ def test_pcolorflaterror():
14381438
with pytest.raises(TypeError, match='Dimensions of C'):
14391439
ax.pcolormesh(x, y, Z, shading='flat')
14401440

1441+
def test_samesizepcolorflaterror():
1442+
fig, ax = plt.subplots()
1443+
x, y = np.meshgrid(np.arange(5), np.arange(3))
1444+
Z = x + y
1445+
with pytest.raises(TypeError, match=r".*X and y should be one larger than C"):
1446+
ax.pcolormesh(x, y, Z, shading='flat')
1447+
14411448

14421449
@pytest.mark.parametrize('snap', [False, True])
14431450
@check_figures_equal(extensions=["png"])

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy