From 3c159ebbe991d13d66aca1e0e3f220f2a2fbfe30 Mon Sep 17 00:00:00 2001 From: Amy Roberts Date: Tue, 3 Mar 2020 12:57:32 -0700 Subject: [PATCH 1/5] improve-matplotlibrc-tutorial: make path/URL option clearer --- tutorials/introductory/customizing.py | 39 ++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index 718cc6414e19..1df3e953661b 100644 --- a/tutorials/introductory/customizing.py +++ b/tutorials/introductory/customizing.py @@ -35,20 +35,10 @@ # ----------------------- # # You can create custom styles and use them by calling `.style.use` with -# the path or URL to the style sheet. Additionally, if you add your -# ``.mplstyle`` file to ``mpl_configdir/stylelib``, you can reuse -# your custom style sheet with a call to ``style.use()``. By -# default ``mpl_configdir`` should be ``~/.config/matplotlib``, but you can -# check where yours is with `matplotlib.get_configdir()`; you may need to -# create this directory. You also can change the directory where Matplotlib -# looks for the stylelib/ folder by setting the :envvar:`MPLCONFIGDIR` -# environment variable, see :ref:`locating-matplotlib-config-dir`. -# -# Note that a custom style sheet in ``mpl_configdir/stylelib`` will override a -# style sheet defined by Matplotlib if the styles have the same name. +# the path or URL to the style sheet. # # For example, you might want to create -# ``mpl_configdir/stylelib/presentation.mplstyle`` with the following:: +# ``../images/presentation.mplstyle`` with the following:: # # axes.titlesize : 24 # axes.labelsize : 20 @@ -61,7 +51,25 @@ # good in a presentation, you can just add:: # # >>> import matplotlib.pyplot as plt -# >>> plt.style.use('presentation') +# >>> plt.style.use('../images/presentation.mplstyle') +# +# Alternatively, you can load your custom style sheet with a call to +# ``style.use()`` by placing your ``.mplstyle`` file +# into ``mpl_configdir/stylelib``. By default ``mpl_configdir`` should be +# ``~/.config/matplotlib``, but you can check where yours is with +# `matplotlib.get_configdir()`; you may need to create this directory. You also +# can change the directory where Matplotlib looks for the stylelib/ folder by +# setting the :envvar:`MPLCONFIGDIR` environment variable, see +# :ref:`locating-matplotlib-config-dir`. +# +# Note that a custom style sheet in ``mpl_configdir/stylelib`` will override a +# style sheet defined by Matplotlib if the styles have the same name. +# +# Once your ``.mplstyle`` file is in the appropriate +# ``mpl_configdir`` you can specify your style with:: +# +# >>> import matplotlib.pyplot as plt +# >>> plt.style.use('') # # # Composing styles @@ -142,8 +150,9 @@ # kinds of properties, which we call 'rc settings' or 'rc parameters'. You can # control the defaults of almost every property in Matplotlib: figure size and # DPI, line width, color and style, axes, axis and grid properties, text and -# font properties and so on. Matplotlib looks for :file:`matplotlibrc` in four -# locations, in the following order: +# font properties and so on. When a URL or path is not specified with a call to +# `style.use('/.mplstyle')`, Matplotlib looks for +# :file:`matplotlibrc` in four locations, in the following order: # # 1. :file:`matplotlibrc` in the current working directory, usually used for # specific customizations that you do not want to apply elsewhere. From 94e8edd553cfaa1d23d5090d7cd36d814605b9a6 Mon Sep 17 00:00:00 2001 From: Amy Roberts Date: Tue, 3 Mar 2020 17:19:36 -0700 Subject: [PATCH 2/5] improve-matplotlibrc-tutorial: fix flake8 compliance --- tutorials/introductory/customizing.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index 1df3e953661b..14017320663f 100644 --- a/tutorials/introductory/customizing.py +++ b/tutorials/introductory/customizing.py @@ -35,7 +35,7 @@ # ----------------------- # # You can create custom styles and use them by calling `.style.use` with -# the path or URL to the style sheet. +# the path or URL to the style sheet. # # For example, you might want to create # ``../images/presentation.mplstyle`` with the following:: @@ -53,19 +53,19 @@ # >>> import matplotlib.pyplot as plt # >>> plt.style.use('../images/presentation.mplstyle') # -# Alternatively, you can load your custom style sheet with a call to -# ``style.use()`` by placing your ``.mplstyle`` file -# into ``mpl_configdir/stylelib``. By default ``mpl_configdir`` should be -# ``~/.config/matplotlib``, but you can check where yours is with +# Alternatively, you can load your custom style sheet with a call to +# ``style.use()`` by placing your ``.mplstyle`` file +# into ``mpl_configdir/stylelib``. By default ``mpl_configdir`` should be +# ``~/.config/matplotlib``, but you can check where yours is with # `matplotlib.get_configdir()`; you may need to create this directory. You also -# can change the directory where Matplotlib looks for the stylelib/ folder by -# setting the :envvar:`MPLCONFIGDIR` environment variable, see +# can change the directory where Matplotlib looks for the stylelib/ folder by +# setting the :envvar:`MPLCONFIGDIR` environment variable, see # :ref:`locating-matplotlib-config-dir`. # # Note that a custom style sheet in ``mpl_configdir/stylelib`` will override a # style sheet defined by Matplotlib if the styles have the same name. # -# Once your ``.mplstyle`` file is in the appropriate +# Once your ``.mplstyle`` file is in the appropriate # ``mpl_configdir`` you can specify your style with:: # # >>> import matplotlib.pyplot as plt @@ -151,7 +151,7 @@ # control the defaults of almost every property in Matplotlib: figure size and # DPI, line width, color and style, axes, axis and grid properties, text and # font properties and so on. When a URL or path is not specified with a call to -# `style.use('/.mplstyle')`, Matplotlib looks for +# ``style.use('/.mplstyle')``, Matplotlib looks for # :file:`matplotlibrc` in four locations, in the following order: # # 1. :file:`matplotlibrc` in the current working directory, usually used for From d03fa01c9185016c1fa4a285bb236807876eb024 Mon Sep 17 00:00:00 2001 From: pibion Date: Thu, 5 Mar 2020 21:25:47 -0700 Subject: [PATCH 3/5] improve-matplotlibrc-tutorial: use simpler directory in tutorials/introductory/customizing.py Co-Authored-By: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- tutorials/introductory/customizing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index 14017320663f..b7454bcd12ed 100644 --- a/tutorials/introductory/customizing.py +++ b/tutorials/introductory/customizing.py @@ -38,7 +38,7 @@ # the path or URL to the style sheet. # # For example, you might want to create -# ``../images/presentation.mplstyle`` with the following:: +# ``./images/presentation.mplstyle`` with the following:: # # axes.titlesize : 24 # axes.labelsize : 20 From 9de92603243779f41cd93fcbcff8c9eb6aa874b9 Mon Sep 17 00:00:00 2001 From: Amy Roberts Date: Thu, 5 Mar 2020 21:30:45 -0700 Subject: [PATCH 4/5] improve-matplotlibrc-tutorial: update introductory/customizing.py make style.use() example consistent with path --- tutorials/introductory/customizing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index b7454bcd12ed..7b52335028c7 100644 --- a/tutorials/introductory/customizing.py +++ b/tutorials/introductory/customizing.py @@ -51,7 +51,7 @@ # good in a presentation, you can just add:: # # >>> import matplotlib.pyplot as plt -# >>> plt.style.use('../images/presentation.mplstyle') +# >>> plt.style.use('./images/presentation.mplstyle') # # Alternatively, you can load your custom style sheet with a call to # ``style.use()`` by placing your ``.mplstyle`` file From 5dce0e3b19b2e4d7607f1bda6524423c6167efb1 Mon Sep 17 00:00:00 2001 From: Amy Roberts Date: Fri, 6 Mar 2020 09:04:05 -0700 Subject: [PATCH 5/5] improve-matplotlibrc-tutorial: update tutorials/introductory/customizing.py change language to improve readability of mpl_configdir section --- tutorials/introductory/customizing.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tutorials/introductory/customizing.py b/tutorials/introductory/customizing.py index 7b52335028c7..11f7c5c2dcc0 100644 --- a/tutorials/introductory/customizing.py +++ b/tutorials/introductory/customizing.py @@ -53,13 +53,14 @@ # >>> import matplotlib.pyplot as plt # >>> plt.style.use('./images/presentation.mplstyle') # -# Alternatively, you can load your custom style sheet with a call to -# ``style.use()`` by placing your ``.mplstyle`` file -# into ``mpl_configdir/stylelib``. By default ``mpl_configdir`` should be +# Alternatively, you can make your style known to Matplotlib by placing +# your ``.mplstyle`` file into ``mpl_configdir/stylelib``. You +# can then load your custom style sheet with a call to +# ``style.use()``. By default ``mpl_configdir`` should be # ``~/.config/matplotlib``, but you can check where yours is with -# `matplotlib.get_configdir()`; you may need to create this directory. You also -# can change the directory where Matplotlib looks for the stylelib/ folder by -# setting the :envvar:`MPLCONFIGDIR` environment variable, see +# `matplotlib.get_configdir()`; you may need to create this directory. You +# also can change the directory where Matplotlib looks for the stylelib/ +# folder by setting the :envvar:`MPLCONFIGDIR` environment variable, see # :ref:`locating-matplotlib-config-dir`. # # Note that a custom style sheet in ``mpl_configdir/stylelib`` will override a @@ -69,7 +70,7 @@ # ``mpl_configdir`` you can specify your style with:: # # >>> import matplotlib.pyplot as plt -# >>> plt.style.use('') +# >>> plt.style.use() # # # Composing styles