8000 Merge pull request #16653 from pibion/improve-matplotlibrc-tutorial · matplotlib/matplotlib@f388570 · GitHub
[go: up one dir, main page]

Skip to content

Commit f388570

Browse files
authored
Merge pull request #16653 from pibion/improve-matplotlibrc-tutorial
Tutorials: make path/URL option clearer in matplotlibrc tutorial
2 parents 35ba4d8 + 5dce0e3 commit f388570

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

tutorials/introductory/customizing.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,10 @@
3535
# -----------------------
3636
#
3737
# 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.
4939
#
5040
# For example, you might want to create
51-
# ``mpl_configdir/stylelib/presentation.mplstyle`` with the following::
41+
# ``./images/presentation.mplstyle`` with the following::
5242
#
5343
# axes.titlesize : 24
5444
# axes.labelsize : 20
@@ -61,7 +51,26 @@
6151
# good in a presentation, you can just add::
6252
#
6353
# >>> 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>)
6574
#
6675
#
6776
# Composing styles
@@ -142,8 +151,9 @@
142151
# kinds of properties, which we call 'rc settings' or 'rc parameters'. You can
143152
# control the defaults of almost every property in Matplotlib: figure size and
144153
# 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:
147157
#
148158
# 1. :file:`matplotlibrc` in the current working directory, usually used for
149159
# specific customizations that you do not want to apply elsewhere.

0 commit comments

Comments
 (0)
0