|
4 | 4 | Customizing matplotlib
|
5 | 5 | **********************
|
6 | 6 |
|
| 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 | + |
7 | 44 | .. _customizing-with-matplotlibrc-files:
|
8 | 45 |
|
9 | 46 | The :file:`matplotlibrc` file
|
@@ -46,34 +83,6 @@ loaded from, one can do the following::
|
46 | 83 |
|
47 | 84 | See below for a sample :ref:`matplotlibrc file<matplotlibrc-sample>`.
|
48 | 85 |
|
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 |
| - |
77 | 86 | .. _matplotlibrc-sample:
|
78 | 87 |
|
79 | 88 | A sample matplotlibrc file
|
|
0 commit comments