Skip to content

Commit 16765c2

Browse files
tacaswellmdboom
authored andcommitted
API: Line2D and scatter default to automatic
- for plot, the default marker edge is now the color of the marker - for scatter the marker edge color now follows the face color closes matplotlib#4679
1 parent 4f71e63 commit 16765c2

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

‎doc/users/whats_new/style_changes.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ These changes include:
1818
has been changed. It is based on the Dark2 qualitative color
1919
palette from `colorbrewer <http://colorbrewer2.org/>`__.
2020

21+
- For markers and scatter plots, there is no longer a black outline
22+
around filled markers by default.
23+
2124
- The default date formats are now all based on ISO format, i.e., with
2225
the slowest-moving value first. The date formatters are still
2326
changeable through the ``date.autoformmater.*`` rcParams. Python's

‎lib/matplotlib/axes/_axes.py‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3709,7 +3709,7 @@ def dopatch(xs, ys, **kwargs):
37093709
@docstring.dedent_interpd
37103710
def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
37113711
vmin=None, vmax=None, alpha=None, linewidths=None,
3712-
verts=None, edgecolors=None,
3712+
verts=None, edgecolors='face',
37133713
**kwargs):
37143714
"""
37153715
Make a scatter plot of x vs y, where x and y are sequence like objects
@@ -3762,11 +3762,16 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
37623762
If None, defaults to (lines.linewidth,).
37633763
37643764
edgecolors : color or sequence of color, optional, default: None
3765-
If None, defaults to (patch.edgecolor).
3765+
If None, defaults to 'face'
3766+
37663767
If 'face', the edge color will always be the same as
3767-
the face color. If it is 'none', the patch boundary will not
3768-
be drawn. For non-filled markers, the `edgecolors` kwarg
3769-
is ignored; color is determined by `c`.
3768+
the face color.
3769+
3770+
If it is 'none', the patch boundary will not
3771+
be drawn.
3772+
3773+
For non-filled markers, the `edgecolors` kwarg
3774+
is ignored and forced to 'face' internally.
37703775
37713776
Returns
37723777
-------
@@ -3822,6 +3827,8 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
38223827
c = facecolors
38233828
else:
38243829
c = 'b' # The original default
3830+
if edgecolors is None:
3831+
edgecolors = 'face'
38253832

38263833
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
38273834
x = self.convert_xunits(x)

‎lib/matplotlib/lines.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,7 @@ def get_marker(self):
848848
def get_markeredgecolor(self):
849849
mec = self._markeredgecolor
850850
if (is_string_like(mec) and mec == 'auto'):
851-
if self._marker.get_marker() in ('.', ','):
852-
return self._color
853-
if self._marker.is_filled() and self.get_fillstyle() != 'none':
854-
return 'k' # Bad hard-wired default...
855-
else:
856-
return self._color
851+
return self._color
857852
else:
858853
return mec
859854

0 commit comments

Comments
 (0)