Skip to content

Commit

Permalink
Merge pull request matplotlib#6202 from mdboom/default-scatter-size
Browse files Browse the repository at this point in the history
Fix matplotlib#6136: Don't hardcode default scatter size
  • Loading branch information
efiring committed Mar 22, 2016
1 parent 4e14ae0 commit 302c7fd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions doc/users/whats_new/style_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
```````````

Expand Down
12 changes: 9 additions & 3 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3725,7 +3725,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):
Expand All @@ -3738,8 +3738,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
Expand Down Expand Up @@ -3860,6 +3860,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
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3231,7 +3231,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()
Expand Down

0 comments on commit 302c7fd

Please sign in to comment.