Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f93c204

Browse files
committed
Fix support for clim in scatter.
This is the same issue and same fix as for pcolor{,mesh} in 2d8f3be.
1 parent 7eaf90b commit f93c204

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4429,13 +4429,12 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
44294429
alpha=alpha
44304430
)
44314431
collection.set_transform(mtransforms.IdentityTransform())
4432-
collection.update(kwargs)
4433-
44344432
if colors is None:
44354433
collection.set_array(c)
44364434
collection.set_cmap(cmap)
44374435
collection.set_norm(norm)
44384436
collection._scale_norm(norm, vmin, vmax)
4437+
collection.update(kwargs)
44394438

44404439
# Classic mode only:
44414440
# ensure there are margins to allow for the

lib/matplotlib/tests/test_axes.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from collections import namedtuple
22
import datetime
33
from decimal import Decimal
4+
from functools import partial
45
import io
56
from itertools import product
67
import platform
@@ -7271,7 +7272,13 @@ def test_empty_line_plots():
72717272

72727273
def test_clim():
72737274
ax = plt.figure().add_subplot()
7274-
for plot_method in [ax.imshow, ax.pcolor, ax.pcolormesh, ax.pcolorfast]:
7275+
for plot_method in [
7276+
partial(ax.scatter, range(3), range(3), c=range(3)),
7277+
partial(ax.imshow, [[0, 1], [2, 3]]),
7278+
partial(ax.pcolor, [[0, 1], [2, 3]]),
7279+
partial(ax.pcolormesh, [[0, 1], [2, 3]]),
7280+
partial(ax.pcolorfast, [[0, 1], [2, 3]]),
7281+
]:
72757282
clim = (7, 8)
7276-
norm = plot_method([[0, 1], [2, 3]], clim=clim).norm
7283+
norm = plot_method(clim=clim).norm
72777284
assert (norm.vmin, norm.vmax) == clim

0 commit comments

Comments
 (0)