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

Skip to content

Commit 13edbb5

Browse files
committed
Fix #6136: Don't hardcode default scatter size
1 parent c1aecd1 commit 13edbb5

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

doc/users/whats_new/style_changes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ Colors
2828
- Grid lines are light grey solid 1pt lines. They are no longer dashed by
2929
default.
3030

31+
Plots
32+
`````
33+
34+
- The default size of the elements in a scatter plot is now based on
35+
the rcParam ``lines.markersize`` so it is consistent with ``plot(X,
36+
Y, 'o')``. The old value was 20.
37+
3138
Plot layout
3239
```````````
3340

lib/matplotlib/axes/_axes.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3726,7 +3726,7 @@ def dopatch(xs, ys, **kwargs):
37263726
'facecolors', 'color'],
37273727
label_namer="y")
37283728
@docstring.dedent_interpd
3729-
def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
3729+
def scatter(self, x, y, s=None, c=None, marker='o', cmap=None, norm=None,
37303730
vmin=None, vmax=None, alpha=None, linewidths=None,
37313731
verts=None, edgecolors=None,
37323732
**kwargs):
@@ -3861,6 +3861,12 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
38613861
if x.size != y.size:
38623862
raise ValueError("x and y must be the same size")
38633863

3864+
if s is None:
3865+
if rcParams['_internal.classic_mode']:
3866+
s = 20
3867+
else:
3868+
s = rcParams['lines.markersize'] ** 2.0
3869+
38643870
s = np.ma.ravel(s) # This doesn't have to match x, y in size.
38653871

38663872
# After this block, c_array will be None unless

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3138,7 +3138,7 @@ def quiverkey(*args, **kw):
31383138
# This function was autogenerated by boilerplate.py. Do not edit as
31393139
# changes will be lost
31403140
@_autogen_docstring(Axes.scatter)
3141-
def scatter(x, y, s=20, c=None, marker='o', cmap=None, norm=None, vmin=None,
3141+
def scatter(x, y, s=None, c=None, marker='o', cmap=None, norm=None, vmin=None,
31423142
vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None,
31433143
hold=None, data=None, **kwargs):
31443144
ax = gca()

0 commit comments

Comments
 (0)