8000 DOC: clarify rc_context resets all rcParams changes · matplotlib/matplotlib@724387e · GitHub
[go: up one dir, main page]

Skip to content

Commit 724387e

Browse files
committed
DOC: clarify rc_context resets all rcParams changes
Inspired by #24351
1 parent c8b9eb4 commit 724387e

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
@@ -1080,6 +1080,9 @@ def rc_context(rc=None, fname=None):
10801080
10811081
The :rc:`backend` will not be reset by the context manager.
10821082
1083+
rcParams changed both through the context manager invocation and
1084+
in the body of the context will be reset on context exit.
1085+
10831086
Parameters
10841087
----------
10851088
rc : dict
@@ -1107,6 +1110,13 @@ def rc_context(rc=None, fname=None):
11071110
with mpl.rc_context(fname='print.rc'):
11081111
plt.plot(x, y) # uses 'print.rc'
11091112
1113+
Setting in the context body::
1114+
1115+
with mpl.rc_context():
1116+
# will be reset
1117+
mpl.rcParams['lines.linewidth'] = 5
1118+
plt.plot(x, y)
1119+
11101120
"""
11111121
orig = dict(rcParams.copy())
11121122
del orig['backend']

0 commit comments

Comments
 (0)
0