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

Skip to content

Commit dca6c7a

Browse files
authored
Merge pull request #24358 from meeseeksmachine/auto-backport-of-pr-24354-on-v3.6.x
Backport PR #24354 on branch v3.6.x (DOC: clarify rc_context resets all rcParams changes)
2 parents bcce38f + d80564b commit dca6c7a

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
@@ -1062,6 +1062,9 @@ def rc_context(rc=None, fname=None):
10621062
10631063
The :rc:`backend` will not be reset by the context manager.
10641064
1065+
rcParams changed both through the context manager invocation and
1066+
in the body of the context will be reset on context exit.
1067+
10651068
Parameters
10661069
----------
10671070
rc : dict
@@ -1089,6 +1092,13 @@ def rc_context(rc=None, fname=None):
10891092
with mpl.rc_context(fname='print.rc'):
10901093
plt.plot(x, y) # uses 'print.rc'
10911094
1095+
Setting in the context body::
1096+
1097+
with mpl.rc_context():
1098+
# will be reset
1099+
mpl.rcParams['lines.linewidth'] = 5
1100+
plt.plot(x, y)
1101+
10921102
"""
10931103
orig = dict(rcParams.copy())
10941104
del orig['backend']

0 commit comments

Comments
 (0)