From 1ed30d033847240093072b714447c33bf616e1ae Mon Sep 17 00:00:00 2001 From: wemi3 <62965919+wemi3@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:27:28 -0700 Subject: [PATCH] Backport PR #26930: Added documentation on getting full list of registered colormaps re: issue #26244 --- galleries/users_explain/colors/colormaps.py | 5 +++++ lib/matplotlib/cm.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/galleries/users_explain/colors/colormaps.py b/galleries/users_explain/colors/colormaps.py index a38dd2af0fc9..92b56d298976 100644 --- a/galleries/users_explain/colors/colormaps.py +++ b/galleries/users_explain/colors/colormaps.py @@ -15,6 +15,11 @@ help on creating your own colormaps, see :ref:`colormap-manipulation`. +To get a list of all registered colormaps, you can do:: + + from matplotlib import colormaps + list(colormaps) + Overview ======== diff --git a/lib/matplotlib/cm.py b/lib/matplotlib/cm.py index a2cd3788114d..3911986f3673 100644 --- a/lib/matplotlib/cm.py +++ b/lib/matplotlib/cm.py @@ -74,6 +74,11 @@ class ColormapRegistry(Mapping): Additional colormaps can be added via `.ColormapRegistry.register`:: mpl.colormaps.register(my_colormap) + + To get a list of all registered colormaps, you can do:: + + from matplotlib import colormaps + list(colormaps) """ def __init__(self, cmaps): self._cmaps = cmaps