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

Skip to content

Commit 1d9880c

Browse files
author
Gauravjeet
committed
Add markerfacecolor and markeredgecolor to the rcParams for lines
1 parent 575e013 commit 1d9880c

5 files changed

Lines changed: 22 additions & 0 deletions

File tree

lib/matplotlib/lines.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ def __init__(self, xdata, ydata,
326326
linestyle = rcParams['lines.linestyle']
327327
if marker is None:
328328
marker = rcParams['lines.marker']
329+
if markerfacecolor is None:
330+
markerfacecolor = rcParams['lines.markerfacecolor']
331+
if markeredgecolor is None:
332+
markeredgecolor = rcParams['lines.markeredgecolor']
329333
if color is None:
330334
color = rcParams['lines.color']
331335

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ lines.linewidth : 1.0 # line width in points
88
lines.linestyle : - # solid line
99
lines.color : b # has no affect on plot(); see axes.prop_cycle
1010
lines.marker : None # the default marker
11+
lines.markerfacecolor : auto # the default markerfacecolor
12+
lines.markeredgecolor : auto # the default markeredgecolor
1113
lines.markeredgewidth : 0.5 # the line width around the marker symbol
1214
lines.markersize : 6 # markersize, in points
1315
lines.dash_joinstyle : round # miter|round|bevel

lib/matplotlib/rcsetup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,8 @@ def _validate_linestyle(ls):
946946
'lines.linestyle': ['-', _validate_linestyle], # solid line
947947
'lines.color': ['C0', validate_color], # first color in color cycle
948948
'lines.marker': ['None', validate_string], # marker name
949+
'lines.markerfacecolor': ['auto', validate_color_or_auto], # default color
950+
'lines.markeredgecolor': ['auto', validate_color_or_auto], # default color
949951
'lines.markeredgewidth': [1.0, validate_float],
950952
'lines.markersize': [6, validate_float], # markersize, in points
951953
'lines.antialiased': [True, validate_bool], # antialiased (no jaggies)

lib/matplotlib/tests/test_rcparams.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,18 @@ def test_legend_colors(color_type, param_dict, target):
180180
assert getattr(leg.legendPatch, get_func)() == target
181181

182182

183+
def test_mfc_rcparams():
184+
mpl.rcParams['lines.markerfacecolor'] = 'r'
185+
ln = mpl.lines.Line2D([1, 2], [1, 2])
186+
assert ln.get_markerfacecolor() == 'r'
187+
188+
189+
def test_mec_rcparams():
190+
mpl.rcParams['lines.markeredgecolor'] = 'r'
191+
ln = mpl.lines.Line2D([1, 2], [1, 2])
192+
assert ln.get_markeredgecolor() == 'r'
193+
194+
183195
def test_Issue_1713():
184196
utf32_be = os.path.join(os.path.dirname(__file__),
185197
'test_utf32_be_rcparams.rc')

matplotlibrc.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ backend : $TEMPLATE_BACKEND
7878
#lines.linestyle : - ## solid line
7979
#lines.color : C0 ## has no affect on plot(); see axes.prop_cycle
8080
#lines.marker : None ## the default marker
81+
#lines.markerfacecolor : auto ## the default markerfacecolor
82+
#lines.markeredgecolor : auto ## the default markeredgecolor
8183
#lines.markeredgewidth : 1.0 ## the line width around the marker symbol
8284
#lines.markersize : 6 ## markersize, in points
8385
#lines.dash_joinstyle : round ## miter|round|bevel

0 commit comments

Comments
 (0)