From f93c20444d9da4dfdc606540586fb4c9a10aed2f Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 2 Nov 2021 18:41:23 +0100 Subject: [PATCH] Fix support for clim in scatter. This is the same issue and same fix as for pcolor{,mesh} in 2d8f3be. --- lib/matplotlib/axes/_axes.py | 3 +-- lib/matplotlib/tests/test_axes.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 91badadf088e..d372bde96594 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4429,13 +4429,12 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, alpha=alpha ) collection.set_transform(mtransforms.IdentityTransform()) - collection.update(kwargs) - if colors is None: collection.set_array(c) collection.set_cmap(cmap) collection.set_norm(norm) collection._scale_norm(norm, vmin, vmax) + collection.update(kwargs) # Classic mode only: # ensure there are margins to allow for the diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 27fc6aba2e3f..6a6e9a86de18 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1,6 +1,7 @@ from collections import namedtuple import datetime from decimal import Decimal +from functools import partial import io from itertools import product import platform @@ -7271,7 +7272,13 @@ def test_empty_line_plots(): def test_clim(): ax = plt.figure().add_subplot() - for plot_method in [ax.imshow, ax.pcolor, ax.pcolormesh, ax.pcolorfast]: + for plot_method in [ + partial(ax.scatter, range(3), range(3), c=range(3)), + partial(ax.imshow, [[0, 1], [2, 3]]), + partial(ax.pcolor, [[0, 1], [2, 3]]), + partial(ax.pcolormesh, [[0, 1], [2, 3]]), + partial(ax.pcolorfast, [[0, 1], [2, 3]]), + ]: clim = (7, 8) - norm = plot_method([[0, 1], [2, 3]], clim=clim).norm + norm = plot_method(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