|
35 | 35 | # ----------------------- |
36 | 36 | # |
37 | 37 | # You can create custom styles and use them by calling `.style.use` with |
38 | | -# the path or URL to the style sheet. Additionally, if you add your |
39 | | -# ``<style-name>.mplstyle`` file to ``mpl_configdir/stylelib``, you can reuse |
40 | | -# your custom style sheet with a call to ``style.use(<style-name>)``. By |
41 | | -# default ``mpl_configdir`` should be ``~/.config/matplotlib``, but you can |
42 | | -# check where yours is with `matplotlib.get_configdir()`; you may need to |
43 | | -# create this directory. You also can change the directory where Matplotlib |
44 | | -# looks for the stylelib/ folder by setting the :envvar:`MPLCONFIGDIR` |
45 | | -# environment variable, see :ref:`locating-matplotlib-config-dir`. |
46 | | -# |
47 | | -# Note that a custom style sheet in ``mpl_configdir/stylelib`` will override a |
48 | | -# style sheet defined by Matplotlib if the styles have the same name. |
| 38 | +# the path or URL to the style sheet. |
49 | 39 | # |
50 | 40 | # For example, you might want to create |
51 | | -# ``mpl_configdir/stylelib/presentation.mplstyle`` with the following:: |
| 41 | +# ``../images/presentation.mplstyle`` with the following:: |
52 | 42 | # |
53 | 43 | # axes.titlesize : 24 |
54 | 44 | # axes.labelsize : 20 |
|
61 | 51 | # good in a presentation, you can just add:: |
62 | 52 | # |
63 | 53 | # >>> import matplotlib.pyplot as plt |
64 | | -# >>> plt.style.use('presentation') |
| 54 | +# >>> plt.style.use('../images/presentation.mplstyle') |
| 55 | +# |
| 56 | +# Alternatively, you can load your custom style sheet with a call to |
| 57 | +# ``style.use(<style-name>)`` by placing your ``<style-name>.mplstyle`` file |
| 58 | +# into ``mpl_configdir/stylelib``. By default ``mpl_configdir`` should be |
| 59 | +# ``~/.config/matplotlib``, but you can check where yours is with |
| 60 | +# `matplotlib.get_configdir()`; you may need to create this directory. You also |
| 61 | +# can change the directory where Matplotlib looks for the stylelib/ folder by |
| 62 | +# setting the :envvar:`MPLCONFIGDIR` environment variable, see |
| 63 | +# :ref:`locating-matplotlib-config-dir`. |
| 64 | +# |
| 65 | +# Note that a custom style sheet in ``mpl_configdir/stylelib`` will override a |
| 66 | +# style sheet defined by Matplotlib if the styles have the same name. |
| 67 | +# |
| 68 | +# Once your ``<style-name>.mplstyle`` file is in the appropriate |
| 69 | +# ``mpl_configdir`` you can specify your style with:: |
| 70 | +# |
| 71 | +# >>> import matplotlib.pyplot as plt |
| 72 | +# >>> plt.style.use('<style-name>') |
65 | 73 | # |
66 | 74 | # |
67 | 75 | # Composing styles |
|
142 | 150 | # kinds of properties, which we call 'rc settings' or 'rc parameters'. You can |
143 | 151 | # control the defaults of almost every property in Matplotlib: figure size and |
144 | 152 | # DPI, line width, color and style, axes, axis and grid properties, text and |
145 | | -# font properties and so on. Matplotlib looks for :file:`matplotlibrc` in four |
146 | | -# locations, in the following order: |
| 153 | +# font properties and so on. When a URL or path is not specified with a call to |
| 154 | +# `style.use('<path>/<style-name>.mplstyle')`, Matplotlib looks for |
| 155 | +# :file:`matplotlibrc` in four locations, in the following order: |
147 | 156 | # |
148 | 157 | # 1. :file:`matplotlibrc` in the current working directory, usually used for |
149 | 158 | # specific customizations that you do not want to apply elsewhere. |
|
0 commit comments