|
4 | 4 | Customizing matplotlib |
5 | 5 | ********************** |
6 | 6 |
|
| 7 | +.. _customizing-with-dynamic-rc-settings: |
| 8 | + |
| 9 | +Dynamic rc settings |
| 10 | +=================== |
| 11 | + |
| 12 | +You can also dynamically change the default rc settings in a python script or |
| 13 | +interactively from the python shell. All of the rc settings are stored in a |
| 14 | +dictionary-like variable called :data:`matplotlib.rcParams`, which is global to |
| 15 | +the matplotlib package. rcParams can be modified directly, for example:: |
| 16 | + |
| 17 | + import matplotlib as mpl |
| 18 | + mpl.rcParams['lines.linewidth'] = 2 |
| 19 | + mpl.rcParams['lines.color'] = 'r' |
| 20 | + |
| 21 | +Matplotlib also provides a couple of convenience functions for modifying rc |
| 22 | +settings. The :func:`matplotlib.rc` command can be used to modify multiple |
| 23 | +settings in a single group at once, using keyword arguments:: |
| 24 | + |
| 25 | + import matplotlib as mpl |
| 26 | + mpl.rc('lines', linewidth=2, color='r') |
| 27 | + |
| 28 | +The :func:`matplotlib.rcdefaults` command will restore the standard matplotlib |
| 29 | +default settings. |
| 30 | + |
| 31 | +There is some degree of validation when setting the values of rcParams, see |
| 32 | +:mod:`matplotlib.rcsetup` for details. |
| 33 | + |
7 | 34 | .. _customizing-with-matplotlibrc-files: |
8 | 35 |
|
9 | 36 | The :file:`matplotlibrc` file |
@@ -46,34 +73,6 @@ loaded from, one can do the following:: |
46 | 73 |
|
47 | 74 | See below for a sample :ref:`matplotlibrc file<matplotlibrc-sample>`. |
48 | 75 |
|
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 | 76 | .. _matplotlibrc-sample: |
78 | 77 |
|
79 | 78 | A sample matplotlibrc file |
|
0 commit comments