Skip to content

Commit aca6e9d

Browse files
authored
Merge pull request matplotlib#24354 from tacaswell/doc_rccontext
DOC: clarify rc_context resets all rcParams changes
2 parents 6c09a56 + 724387e commit aca6e9d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,9 @@ def rc_context(rc=None, fname=None):
10711071
10721072
The :rc:`backend` will not be reset by the context manager.
10731073
1074+
rcParams changed both through the context manager invocation and
1075+
in the body of the context will be reset on context exit.
1076+
10741077
Parameters
10751078
----------
10761079
rc : dict
@@ -1098,6 +1101,13 @@ def rc_context(rc=None, fname=None):
10981101
with mpl.rc_context(fname='print.rc'):
10991102
plt.plot(x, y) # uses 'print.rc'
11001103
1104+
Setting in the context body::
1105+
1106+
with mpl.rc_context():
1107+
# will be reset
1108+
mpl.rcParams['lines.linewidth'] = 5
1109+
plt.plot(x, y)
1110+
11011111
"""
11021112
orig = dict(rcParams.copy())
11031113
del orig['backend']

0 commit comments

Comments
 (0)