Skip to content

Commit 8ef48a8

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 9b24329 commit 8ef48a8

5 files changed

Lines changed: 32 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
@@ -20,6 +20,9 @@ These changes include:
2020
has been changed. It is based on the Dark2 qualitative color
2121
palette from `colorbrewer <http://colorbrewer2.org/>`__.
2222

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

‎lib/matplotlib/axes/_axes.py‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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
-------
@@ -3823,6 +3828,9 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
38233828
else:
38243829
c = 'b' # The original default
38253830

3831+
if edgecolors is None and not rcParams['_internal.classic_mode']:
3832+
edgecolors = 'face'
3833+
38263834
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
38273835
x = self.convert_xunits(x)
38283836
y = self.convert_yunits(y)

‎lib/matplotlib/lines.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,12 @@ 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+
if rcParams['_internal.classic_mode']:
852+
if self._marker.get_marker() in ('.', ','):
853+
return self._color
854+
if self._marker.is_filled() and self.get_fillstyle() != 'none':
855+
return 'k' # Bad hard-wired default...
856+
return self._color
857857
else:
858858
return mec
859859

‎lib/matplotlib/mpl-data/stylelib/classic.mplstyle‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,6 @@ animation.convert_path: convert # Path to ImageMagick's convert binary.
498498
# is also the name of a system tool.
499499
animation.convert_args:
500500
animation.html: none
501+
502+
503+
_internal.classic_mode: True # Turn on backward compatibility hacks

‎lib/matplotlib/rcsetup.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,14 @@ def validate_cycler(s):
11991199
'animation.convert_path': ['convert', six.text_type],
12001200
# Additional arguments for mencoder movie writer (using pipes)
12011201

1202-
'animation.convert_args': [[], validate_stringlist]}
1202+
'animation.convert_args': [[], validate_stringlist],
1203+
1204+
# Classic (pre 2.0) compatibility mode
1205+
# This is used for things that are hard to make backward compatible
1206+
# with a sane rcParam alone. This does *not* turn on classic mode
1207+
# altogether. For that use `matplotlib.style.use('classic')`.
1208+
'_internal.classic_mode': [False, validate_bool]
1209+
}
12031210

12041211

12051212
if __name__ == '__main__':

0 commit comments

Comments
 (0)