From 6899ea8db0d05793780879d1e1c5e86d1efa4d6c Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 12 Jul 2023 10:58:56 -0500 Subject: [PATCH] Backport PR #26195: [Doc] link style sheets reference to customization tutorial --- doc/api/style_api.rst | 6 +++--- examples/style_sheets/style_sheets_reference.py | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/api/style_api.rst b/doc/api/style_api.rst index 84bbe8b25c84..08d8d5ec1c4d 100644 --- a/doc/api/style_api.rst +++ b/doc/api/style_api.rst @@ -20,13 +20,13 @@ the builtin styles. .. imported variables have to be specified explicitly due to https://github.com/sphinx-doc/sphinx/issues/6607 -.. data:: matplotlib.style.library +.. data:: library - A dict mapping from style name to `.RcParams` defining that style. + A dict mapping from style name to `.rcParams` defining that style. This is meant to be read-only. Use `.reload_library` to update. -.. data:: matplotlib.style.available +.. data:: available List of the names of the available styles. diff --git a/examples/style_sheets/style_sheets_reference.py b/examples/style_sheets/style_sheets_reference.py index 8557cc10a203..49667e6996d5 100644 --- a/examples/style_sheets/style_sheets_reference.py +++ b/examples/style_sheets/style_sheets_reference.py @@ -5,8 +5,19 @@ This script demonstrates the different available style sheets on a common set of example plots: scatter plot, image, bar graph, patches, -line plot and histogram, +line plot and histogram. +Any of these style sheets can be imported (i.e. activated) by its name. +For example for the ggplot style: + +>>> plt.style.use('ggplot') + +The names of the available style sheets can be found +in the list `matplotlib.style.available` +(they are also printed in the corner of each plot below). + +See more details in :ref:`Customizing Matplotlib +using style sheets`. """ import numpy as np