Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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