Skip to content

Commit 91ee83e

Browse files
authored
Merge pull request matplotlib#15369 from timhoffm/doc-style
Update style docs
2 parents 5e74fb4 + 979b962 commit 91ee83e

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

doc/api/style_api.rst

+16-4
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,32 @@
22
``matplotlib.style``
33
********************
44

5-
.. seealso::
5+
Styles are predefined sets of `.rcParams` that define the visual appearance of
6+
a plot.
67

7-
Examples of using style sheets with :func:`matplotlib.style.use` can be found at :doc:`/gallery/style_sheets/style_sheets_reference`.
8+
:doc:`/tutorials/introductory/customizing` describes the mechanism and usage
9+
of styles.
10+
11+
The :doc:`/gallery/style_sheets/style_sheets_reference` gives an overview of
12+
the builtin styles.
813

914
.. automodule:: matplotlib.style
1015
:members:
1116
:undoc-members:
1217
:show-inheritance:
1318
:imported-members:
1419

20+
.. imported variables have to be specified explicitly due to
21+
https://github.com/sphinx-doc/sphinx/issues/6607
22+
1523
.. data:: matplotlib.style.library
1624

17-
Dictionary of available styles
25+
A dict mapping from style name to `.RcParams` defining that style.
26+
27+
This is meant to be read-only. Use `.reload_library` to update.
1828

1929
.. data:: matplotlib.style.available
2030

21-
List of available styles
31+
List of the names of the available styles.
32+
33+
This is meant to be read-only. Use `.reload_library` to update.

lib/matplotlib/style/core.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ def use(style):
7171
The style name of 'default' is reserved for reverting back to
7272
the default style settings.
7373
74+
.. note::
75+
76+
This updates the `.rcParams` with the settings from the style.
77+
`.rcParams` not defined in the style are kept.
78+
7479
Parameters
7580
----------
7681
style : str, dict, Path or list
@@ -168,7 +173,7 @@ def iter_user_libraries():
168173

169174

170175
def update_user_library(library):
171-
"""Update style library with user-defined rc files"""
176+
"""Update style library with user-defined rc files."""
172177
for stylelib_path in iter_user_libraries():
173178
styles = read_style_directory(stylelib_path)
174179
update_nested_dict(library, styles)
@@ -216,11 +221,12 @@ def update_nested_dict(main_dict, new_dict):
216221
_base_library = load_base_library()
217222

218223
library = None
224+
219225
available = []
220226

221227

222228
def reload_library():
223-
"""Reload style library."""
229+
"""Reload the style library."""
224230
global library
225231
library = update_user_library(_base_library)
226232
available[:] = sorted(library.keys())

0 commit comments

Comments
 (0)