|
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 make your style known to Matplotlib by placing |
| 57 | +# your ``<style-name>.mplstyle`` file into ``mpl_configdir/stylelib``. You |
| 58 | +# can then load your custom style sheet with a call to |
| 59 | +# ``style.use(<style-name>)``. By default ``mpl_configdir`` should be |
| 60 | +# ``~/.config/matplotlib``, but you can check where yours is with |
| 61 | +# `matplotlib.get_configdir()`; you may need to create this directory. You |
| 62 | +# also can change the directory where Matplotlib looks for the stylelib/ |
| 63 | +# folder by setting the :envvar:`MPLCONFIGDIR` environment variable, see |
| 64 | +# :ref:`locating-matplotlib-config-dir`. |
| 65 | +# |
| 66 | +# Note that a custom style sheet in ``mpl_configdir/stylelib`` will override a |
| 67 | +# style sheet defined by Matplotlib if the styles have the same name. |
| 68 | +# |
| 69 | +# Once your ``<style-name>.mplstyle`` file is in the appropriate |
| 70 | +# ``mpl_configdir`` you can specify your style with:: |
| 71 | +# |
| 72 | +# >>> import matplotlib.pyplot as plt |
| 73 | +# >>> plt.style.use(<style-name>) |
65 | 74 | #
|
66 | 75 | #
|
67 | 76 | # Composing styles
|
|
142 | 151 | # kinds of properties, which we call 'rc settings' or 'rc parameters'. You can
|
143 | 152 | # control the defaults of almost every property in Matplotlib: figure size and
|
144 | 153 | # 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: |
| 154 | +# font properties and so on. When a URL or path is not specified with a call to |
| 155 | +# ``style.use('<path>/<style-name>.mplstyle')``, Matplotlib looks for |
| 156 | +# :file:`matplotlibrc` in four locations, in the following order: |
147 | 157 | #
|
148 | 158 | # 1. :file:`matplotlibrc` in the current working directory, usually used for
|
149 | 159 | # specific customizations that you do not want to apply elsewhere.
|
|
0 commit comments