There was an error while loading. Please reload this page.
1 parent 24caa1b commit c4b1e02Copy full SHA for c4b1e02
2 files changed
lib/matplotlib/axes/_axes.py
@@ -4471,10 +4471,11 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
4471
collection.set_cmap(cmap)
4472
collection.set_norm(norm)
4473
4474
- if vmin is not None or vmax is not None:
4475
- collection.set_clim(vmin, vmax)
4476
- else:
4477
- collection.autoscale_None()
+ if norm is None:
+ if vmin is not None or vmax is not None:
+ collection.set_clim(vmin, vmax)
+ else:
4478
+ collection.autoscale_None()
4479
4480
# Classic mode only:
4481
# ensure there are margins to allow for the
lib/matplotlib/tests/test_axes.py
@@ -1973,6 +1973,15 @@ def test_scatter_no_invalid_color(self, fig_test, fig_ref):
1973
ax = fig_ref.subplots()
1974
ax.scatter([0, 2], [0, 2], c=[1, 2], s=[1, 3], cmap=cmap)
1975
1976
+ @check_figures_equal(extensions=["png"])
1977
+ def test_scatter_norm_vminvmax(self, fig_test, fig_ref):
1978
+ """Parameters vmin, vmax should be ignored if norm is given."""
1979
+ x = [1, 2, 3]
1980
+ ax = fig_ref.subplots()
1981
+ ax.scatter(x, x, c=x, norm=mcolors.Normalize(-10, 10))
1982
+ ax = fig_test.subplots()
1983
+ ax.scatter(x, x, c=x, norm=mcolors.Normalize(-10, 10), vmin=0, vmax=5)
1984
+
1985
@check_figures_equal(extensions=["png"])
1986
def test_scatter_single_point(self, fig_test, fig_ref):
1987
ax = fig_test.subplots()
0 commit comments