diff --git a/doc/users/whats_new/style_changes.rst b/doc/users/whats_new/style_changes.rst index 5116f1bc12e..c1152e6bba0 100644 --- a/doc/users/whats_new/style_changes.rst +++ b/doc/users/whats_new/style_changes.rst @@ -28,6 +28,13 @@ Colors - Grid lines are light grey solid 1pt lines. They are no longer dashed by default. +Plots +````` + +- The default size of the elements in a scatter plot is now based on + the rcParam ``lines.markersize`` so it is consistent with ``plot(X, + Y, 'o')``. The old value was 20, and the new value is 36 (6^2). + Plot layout ``````````` diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 49d755ae195..e695b32baa1 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3726,7 +3726,7 @@ def dopatch(xs, ys, **kwargs): 'facecolors', 'color'], label_namer="y") @docstring.dedent_interpd - def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None, + def scatter(self, x, y, s=None, c=None, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None, **kwargs): @@ -3739,8 +3739,8 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None, x, y : array_like, shape (n, ) Input data - s : scalar or array_like, shape (n, ), optional, default: 20 - size in points^2. + s : scalar or array_like, shape (n, ), optional + size in points^2. Default is `rcParams['lines.markersize'] ** 2`. c : color, sequence, or sequence of color, optional, default: 'b' `c` can be a single color format string, or a sequence of color @@ -3861,6 +3861,12 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None, if x.size != y.size: raise ValueError("x and y must be the same size") + if s is None: + if rcParams['_internal.classic_mode']: + s = 20 + else: + s = rcParams['lines.markersize'] ** 2.0 + s = np.ma.ravel(s) # This doesn't have to match x, y in size. # After this block, c_array will be None unless diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 5ea396df7df..9b3dd9ea81b 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -3138,7 +3138,7 @@ def quiverkey(*args, **kw): # This function was autogenerated by boilerplate.py. Do not edit as # changes will be lost @_autogen_docstring(Axes.scatter) -def scatter(x, y, s=20, c=None, marker='o', cmap=None, norm=None, vmin=None, +def scatter(x, y, s=None, c=None, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None, hold=None, data=None, **kwargs): ax = gca()