8000 Merge pull request #21525 from anntzer/scatterclim · matplotlib/matplotlib@8aefd6f · GitHub
[go: up one dir, main page]

Skip to content

Commit 8aefd6f

Browse files
authored
Merge pull request #21525 from anntzer/scatterclim
Fix support for clim in scatter.
2 parents bf40e89 + f93c204 commit 8aefd6f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4422,13 +4422,12 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
44224422
alpha=alpha
44234423
)
44244424
collection.set_transform(mtransforms.IdentityTransform())
4425-
collection.update(kwargs)
4426-
44274425
if colors is None:
44284426
collection.set_array(c)
44294427
collection.set_cmap(cmap)
44304428
collection.set_norm(norm)
44314429
collection._scale_norm(norm, vmin, vmax)
4430+
collection.update(kwargs)
44324431

44334432
# Classic mode only:
44344433
# 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
@@ -7289,7 +7290,13 @@ def test_empty_line_plots():
72897290

72907291
def test_clim():
72917292
ax = plt.figure().add_subplot()
7292-
for plot_method in [ax.imshow, ax.pcolor, ax.pcolormesh, ax.pcolorfast]:
7293+
for plot_method in [
7294+
partial(ax.scatter, range(3), range(3), c=range(3)),
7295+
partial(ax.imshow, [[0, 1], [2, 3]]),
7296+
partial(ax.pcolor, [[0, 1], [2, 3]]),
7297+
partial(ax.pcolormesh, [[0, 1], [2, 3]]),
7298+
partial(ax.pcolorfast, [[0, 1], [2, 3]]),
7299+
]:
72937300
clim = (7, 8)
7294-
norm = plot_method([[0, 1], [2, 3]], clim=clim).norm
7301+
norm = plot_method(clim=clim).norm
72957302
assert (norm.vmin, norm.vmax) == clim

0 commit comments

Comments
 (0)
0