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

Skip to content

Commit 717bb40

Browse files
phobsondstansby
authored andcommitted
Merge pull request #8526 from anntzer/clarify-rcdefaults-doc
Clarify docs for rcdefaults and friends.
1 parent 605e57b commit 717bb40

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

lib/matplotlib/__init__.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,9 @@ def rc(group, **kwargs):
12551255
12561256
rc('font', **font) # pass in the font dict as kwargs
12571257
1258-
This enables you to easily switch between several configurations.
1259-
Use :func:`~matplotlib.pyplot.rcdefaults` to restore the default
1260-
rc params after changes.
1258+
This enables you to easily switch between several configurations. Use
1259+
``matplotlib.style.use('default')`` or :func:`~matplotlib.rcdefaults` to
1260+
restore the default rc params after changes.
12611261
"""
12621262

12631263
aliases = {
@@ -1284,15 +1284,26 @@ def rc(group, **kwargs):
12841284

12851285

12861286
def rcdefaults():
1287-
"""
1288-
Restore the default rc params. These are not the params loaded by
1289-
the rc file, but mpl's internal params. See rc_file_defaults for
1290-
reloading the default params from the rc file
1287+
"""Restore the rc params from Matplotlib's internal defaults.
1288+
1289+
See Also
1290+
--------
1291+
rc_file_defaults :
1292+
Restore the rc params from the rc file originally loaded by Matplotlib.
1293+
matplotlib.style.use :
1294+
Use a specific style file. Call ``style.use('default')`` to restore
1295+
the default style.
12911296
"""
12921297
rcParams.clear()
12931298
rcParams.update(rcParamsDefault)
12941299

12951300

1301+
def rc_file_defaults():
1302+
"""Restore the rc params from the original rc file loaded by Matplotlib.
1303+
"""
1304+
rcParams.update(rcParamsOrig)
1305+
1306+
12961307
def rc_file(fname):
12971308
"""
12981309
Update rc params from file.
@@ -1347,16 +1358,9 @@ def __exit__(self, type, value, tb):
13471358
rcParams.update(self._rcparams)
13481359

13491360

1350-
def rc_file_defaults():
1351-
"""
1352-
Restore the default rc params from the original matplotlib rc that
1353-
was loaded
1354-
"""
1355-
rcParams.update(rcParamsOrig)
1356-
1357-
_use_error_msg = """ This call to matplotlib.use() has no effect
1358-
because the backend has already been chosen;
1359-
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
1361+
_use_error_msg = """
1362+
This call to matplotlib.use() has no effect because the backend has already
1363+
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
13601364
or matplotlib.backends is imported for the first time.
13611365
"""
13621366

0 commit comments

Comments
 (0)