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

Skip to content

Commit 2e9307e

Browse files
authored
Merge pull request #12905 from timhoffm/rc-file-default
Add optional parameter use_default_template to rc_file()
2 parents 4e967f3 + 9daf41b commit 2e9307e

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
@@ -1088,19 +1088,31 @@ def rc_file_defaults():
10881088
if k not in STYLE_BLACKLIST})
10891089

10901090

1091-
def rc_file(fname):
1091+
def rc_file(fname, *, use_default_template=True):
10921092
"""
10931093
Update rc params from file.
10941094
10951095
Style-blacklisted rc params (defined in
10961096
`matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
1097+
1098+
Parameters
1099+
----------
1100+
fname : str
1101+
Name of file parsed for matplotlib settings.
1102+
1103+
use_default_template : bool
1104+
If True, initialize with default parameters before updating with those
1105+
in the given file. If False, the current configuration persists
1106+
and only the parameters specified in the file are updated.
1107+
10971108
"""
10981109
# Deprecation warnings were already handled in rc_params_from_file, no need
10991110
# to reemit them here.
11001111
with warnings.catch_warnings():
11011112
warnings.simplefilter("ignore", mplDeprecation)
11021113
from .style.core import STYLE_BLACKLIST
1103-
rc_from_file = rc_params_from_file(fname)
1114+
rc_from_file = rc_params_from_file(
1115+
fname, use_default_template=use_default_template)
11041116
rcParams.update({k: rc_from_file[k] for k in rc_from_file
11051117
if k not in STYLE_BLACKLIST})
11061118

0 commit comments

Comments
 (0)