diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index cef0f8c3c88d..f9b63e4d85c7 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5845,12 +5845,8 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None, kwargs.setdefault('snap', False) - collection = mcoll.PolyCollection(verts, **kwargs) - - collection.set_alpha(alpha) - collection.set_array(C) - collection.set_cmap(cmap) - collection.set_norm(norm) + collection = mcoll.PolyCollection( + verts, array=C, cmap=cmap, norm=norm, alpha=alpha, **kwargs) collection._scale_norm(norm, vmin, vmax) self._pcolor_grid_deprecation_helper() @@ -6079,14 +6075,10 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None, # convert to one dimensional array C = C.ravel() - collection = mcoll.QuadMesh( - coords, antialiased=antialiased, shading=shading, **kwargs) snap = kwargs.get('snap', rcParams['pcolormesh.snap']) - collection.set_snap(snap) - collection.set_alpha(alpha) - collection.set_array(C) - collection.set_cmap(cmap) - collection.set_norm(norm) + collection = mcoll.QuadMesh( + coords, antialiased=antialiased, shading=shading, snap=snap, + array=C, cmap=cmap, norm=norm, alpha=alpha, **kwargs) collection._scale_norm(norm, vmin, vmax) self._pcolor_grid_deprecation_helper() diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 2227af37c1d1..e96f9d5605d6 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -7232,3 +7232,11 @@ def test_empty_line_plots(): _, ax = plt.subplots() line = ax.plot([], []) assert len(line) == 1 + + +def test_clim(): + ax = plt.figure().add_subplot() + for plot_method in [ax.imshow, ax.pcolor, ax.pcolormesh, ax.pcolorfast]: + clim = (7, 8) + norm = plot_method([[0, 1], [2, 3]], clim=clim).norm + assert (norm.vmin, norm.vmax) == clim 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