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

Commit0592917

Browse files
authored
Merge pull request#21146 from anntzer/clim
Fix clim handling for pcolor{,mesh}.
2 parents7c1dec8 +6c95d45 commit0592917

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

‎lib/matplotlib/axes/_axes.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5845,12 +5845,8 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
58455845

58465846
kwargs.setdefault('snap',False)
58475847

5848-
collection=mcoll.PolyCollection(verts,**kwargs)
5849-
5850-
collection.set_alpha(alpha)
5851-
collection.set_array(C)
5852-
collection.set_cmap(cmap)
5853-
collection.set_norm(norm)
5848+
collection=mcoll.PolyCollection(
5849+
verts,array=C,cmap=cmap,norm=norm,alpha=alpha,**kwargs)
58545850
collection._scale_norm(norm,vmin,vmax)
58555851
self._pcolor_grid_deprecation_helper()
58565852

@@ -6079,14 +6075,10 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
60796075
# convert to one dimensional array
60806076
C=C.ravel()
60816077

6082-
collection=mcoll.QuadMesh(
6083-
coords,antialiased=antialiased,shading=shading,**kwargs)
60846078
snap=kwargs.get('snap',rcParams['pcolormesh.snap'])
6085-
collection.set_snap(snap)
6086-
collection.set_alpha(alpha)
6087-
collection.set_array(C)
6088-
collection.set_cmap(cmap)
6089-
collection.set_norm(norm)
6079+
collection=mcoll.QuadMesh(
6080+
coords,antialiased=antialiased,shading=shading,snap=snap,
6081+
array=C,cmap=cmap,norm=norm,alpha=alpha,**kwargs)
60906082
collection._scale_norm(norm,vmin,vmax)
60916083
self._pcolor_grid_deprecation_helper()
60926084

‎lib/matplotlib/tests/test_axes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7232,3 +7232,11 @@ def test_empty_line_plots():
72327232
_,ax=plt.subplots()
72337233
line=ax.plot([], [])
72347234
assertlen(line)==1
7235+
7236+
7237+
deftest_clim():
7238+
ax=plt.figure().add_subplot()
7239+
forplot_methodin [ax.imshow,ax.pcolor,ax.pcolormesh,ax.pcolorfast]:
7240+
clim= (7,8)
7241+
norm=plot_method([[0,1], [2,3]],clim=clim).norm
7242+
assert (norm.vmin,norm.vmax)==clim

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp