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

Skip to content

Commit 9daf41b

Browse files
committed
Add optional parameter used_default_template to rc_file()
1 parent f093129 commit 9daf41b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/matplotlib/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,19 +1214,31 @@ def rc_file_defaults():
12141214
if k not in STYLE_BLACKLIST})
12151215

12161216

1217-
def rc_file(fname):
1217+
def rc_file(fname, *, use_default_template=True):
12181218
"""
12191219
Update rc params from file.
12201220
12211221
Style-blacklisted rc params (defined in
12221222
`matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
1223+
1224+
Parameters
1225+
----------
1226+
fname : str
1227+
Name of file parsed for matplotlib settings.
1228+
1229+
use_default_template : bool
1230+
If True, initialize with default parameters before updating with those
1231+
in the given file. If False, the current configuration persists
1232+
and only the parameters specified in the file are updated.
1233+
12231234
"""
12241235
# Deprecation warnings were already handled in rc_params_from_file, no need
12251236
# to reemit them here.
12261237
with warnings.catch_warnings():
12271238
warnings.simplefilter("ignore", mplDeprecation)
12281239
from .style.core import STYLE_BLACKLIST
1229-
rc_from_file = rc_params_from_file(fname)
1240+
rc_from_file = rc_params_from_file(
1241+
fname, use_default_template=use_default_template)
12301242
rcParams.update({k: rc_from_file[k] for k in rc_from_file
12311243
if k not in STYLE_BLACKLIST})
12321244

0 commit comments

Comments
 (0)