10000 Merge pull request #4508 from wackywendell/custom-doc-styles · matplotlib/matplotlib@08cf747 · GitHub
[go: up one dir, main page]

Skip to content

Commit 08cf747

Browse files
committed
Merge pull request #4508 from wackywendell/custom-doc-styles
DOC: "Customizing matplotlib" should mention style sheets
2 parents 854f74a + c6c4cf6 commit 08cf747

File tree

2 files changed

+38
-29
lines changed

2 files changed

+38
-29
lines changed

doc/users/customizing.rst

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,43 @@
44
Customizing matplotlib
55
**********************
66

7+
Using style sheets
8+
==================
9+
10+
Style sheets provide a means for more specific and/or temporary configuration
11+
modifications, but in a repeatable and well-ordered manner. A style sheet is a
12+
file with the same syntax as the :file:`matplotlibrc` file, and when applied, it
13+
will override the :file:`matplotlibrc`.
14+
15+
For more information and examples, see :ref:`style-sheets`.
16+
17+
.. _customizing-with-dynamic-rc-settings:
18+
19+
Dynamic rc settings
20+
===================
21+
22+
You can also dynamically change the default rc settings in a python script or
23+
interactively from the python shell. All of the rc settings are stored in a
24+
dictionary-like variable called :data:`matplotlib.rcParams`, which is global to
25+
the matplotlib package. rcParams can be modified directly, for example::
26+
27+
import matplotlib as mpl
28+
mpl.rcParams['lines.linewidth'] = 2
29+
mpl.rcParams['lines.color'] = 'r'
30+
31+
Matplotlib also provides a couple of convenience functions for modifying rc
32+
settings. The :func:`matplotlib.rc` command can be used to modify multiple
33+
settings in a single group at once, using keyword arguments::
34+
35+
import matplotlib as mpl
36+
mpl.rc('lines', linewidth=2, color='r')
< 10000 code>37+
38+
The :func:`matplotlib.rcdefaults` command will restore the standard matplotlib
39+
default settings.
40+
41+
There is some degree of validation when setting the values of rcParams, see
42+
:mod:`matplotlib.rcsetup` for details.
43+
744
.. _customizing-with-matplotlibrc-files:
845

946
The :file:`matplotlibrc` file
@@ -46,34 +83,6 @@ loaded from, one can do the following::
4683

4784
See below for a sample :ref:`matplotlibrc file<matplotlibrc-sample>`.
4885

49-
.. _customizing-with-dynamic-rc-settings:
50-
51-
Dynamic rc settings
52-
===================
53-
54-
You can also dynamically change the default rc settings in a python script or
55-
interactively from the python shell. All of the rc settings are stored in a
56-
dictionary-like variable called :data:`matplotlib.rcParams`, which is global to
57-
the matplotlib package. rcParams can be modified directly, for example::
58-
59-
import matplotlib as mpl
60-
mpl.rcParams['lines.linewidth'] = 2
61-
mpl.rcParams['lines.color'] = 'r'
62-
63-
Matplotlib also provides a couple of convenience functions for modifying rc
64-
settings. The :func:`matplotlib.rc` command can be used to modify multiple
65-
settings in a single group at once, using keyword arguments::
66-
67-
import matplotlib as mpl
68-
mpl.rc('lines', linewidth=2, color='r')
69-
70-
The :func:`matplotlib.rcdefaults` command will restore the standard matplotlib
71-
default settings.
72-
73-
There is some degree of validation when setting the values of rcParams, see
74-
:mod:`matplotlib.rcsetup` for details.
75-
76-
7786
.. _matplotlibrc-sample:
7887

7988
A sample matplotlibrc file

doc/users/style_sheets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Defining your own style
2626

2727
You can create custom styles and use them by calling ``style.use`` with the
2828
path or URL to the style sheet. Alternatively, if you add your ``<style-name>.mplstyle``
29-
file to ``mpl_configdir/stylelib`, you can reuse your custom style sheet with a call to
29+
file to ``mpl_configdir/stylelib``, you can reuse your custom style sheet with a call to
3030
``style.use(<style-name>)``. By default ``mpl_configdir`` should be ``~/.config/matplotlib``,
3131
but you can check where yours is with ``matplotlib.get_configdir()``, you may need to
3232
create this directory. Note that a custom style sheet in ``mpl_configdir/stylelib``

0 commit comments

Comments
 (0)
0