From e8a4328a4f483178acade734e0bdf76fa85dd48e Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 22 Apr 2017 16:07:58 -0700 Subject: [PATCH] Clarify docs for rcdefaults and friends. --- lib/matplotlib/__init__.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 5ee6fc197905..c66fb18168e2 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1206,9 +1206,9 @@ def rc(group, **kwargs): rc('font', **font) # pass in the font dict as kwargs - This enables you to easily switch between several configurations. - Use :func:`~matplotlib.pyplot.rcdefaults` to restore the default - rc params after changes. + This enables you to easily switch between several configurations. Use + ``matplotlib.style.use('default')`` or :func:`~matplotlib.rcdefaults` to + restore the default rc params after changes. """ aliases = { @@ -1235,15 +1235,26 @@ def rc(group, **kwargs): def rcdefaults(): - """ - Restore the default rc params. These are not the params loaded by - the rc file, but mpl's internal params. See rc_file_defaults for - reloading the default params from the rc file + """Restore the rc params from Matplotlib's internal defaults. + + See Also + -------- + rc_file_defaults : + Restore the rc params from the rc file originally loaded by Matplotlib. + matplotlib.style.use : + Use a specific style file. Call ``style.use('default')`` to restore + the default style. """ rcParams.clear() rcParams.update(rcParamsDefault) +def rc_file_defaults(): + """Restore the rc params from the original rc file loaded by Matplotlib. + """ + rcParams.update(rcParamsOrig) + + def rc_file(fname): """ Update rc params from file. @@ -1306,14 +1317,6 @@ def __exit__(self, type, value, tb): rcParams.update(self._rcparams) -def rc_file_defaults(): - """ - Restore the default rc params from the original matplotlib rc that - was loaded - """ - rcParams.update(rcParamsOrig) - - _use_error_msg = """ This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,