Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf2af86

Browse files
authored
Merge pull request#25070 from meeseeksmachine/auto-backport-of-pr-25058-on-v3.7.x
Backport PR#25058 on branch v3.7.x (fix for pcolormesh doesn't allow shading = 'flat' in the option)
2 parentsf06f866 +fb4a40c commitbf2af86

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

‎lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5748,9 +5748,10 @@ def _pcolorargs(self, funcname, *args, shading='auto', **kwargs):
57485748

57495749
ifshading=='flat':
57505750
if (Nx,Ny)!= (ncols+1,nrows+1):
5751-
raiseTypeError('Dimensions of C %s are incompatible with'
5752-
' X (%d) and/or Y (%d); see help(%s)'% (
5753-
C.shape,Nx,Ny,funcname))
5751+
raiseTypeError(f"Dimensions of C{C.shape} should"
5752+
f" be one smaller than X({Nx}) and Y({Ny})"
5753+
f" while using shading='flat'"
5754+
f" see help({funcname})")
57545755
else:# ['nearest', 'gouraud']:
57555756
if (Nx,Ny)!= (ncols,nrows):
57565757
raiseTypeError('Dimensions of C %s are incompatible with'

‎lib/matplotlib/tests/test_axes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,14 @@ def test_pcolorflaterror():
14391439
ax.pcolormesh(x,y,Z,shading='flat')
14401440

14411441

1442+
deftest_samesizepcolorflaterror():
1443+
fig,ax=plt.subplots()
1444+
x,y=np.meshgrid(np.arange(5),np.arange(3))
1445+
Z=x+y
1446+
withpytest.raises(TypeError,match=r".*one smaller than X"):
1447+
ax.pcolormesh(x,y,Z,shading='flat')
1448+
1449+
14421450
@pytest.mark.parametrize('snap', [False,True])
14431451
@check_figures_equal(extensions=["png"])
14441452
deftest_pcolorauto(fig_test,fig_ref,snap):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp