Skip to content

Commit 979b962

Browse files
committed
Update style docs
1 parent ba7a162 commit 979b962

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
@@ -70,6 +70,11 @@ def use(style):
7070
The style name of 'default' is reserved for reverting back to
7171
the default style settings.
7272
73+
.. note::
74+
75+
This updates the `.rcParams` with the settings from the style.
76+
`.rcParams` not defined in the style are kept.
77+
7378
Parameters
7479
----------
7580
style : str, dict, Path or list
@@ -167,7 +172,7 @@ def iter_user_libraries():
167172

168173

169174
def update_user_library(library):
170-
"""Update style library with user-defined rc files"""
175+
"""Update style library with user-defined rc files."""
171176
for stylelib_path in iter_user_libraries():
172177
styles = read_style_directory(stylelib_path)
173178
update_nested_dict(library, styles)
@@ -215,11 +220,12 @@ def update_nested_dict(main_dict, new_dict):
215220
_base_library = load_base_library()
216221

217222
library = None
223+
218224
available = []
219225

220226

221227
def reload_library():
222-
"""Reload style library."""
228+
"""Reload the style library."""
223229
global library
224230
library = update_user_library(_base_library)
225231
available[:] = sorted(library.keys())

0 commit comments

Comments
 (0)