From 590d24fb37013c62667453f1e42138324f3f0de1 Mon Sep 17 00:00:00 2001 From: wemi3 <62965919+wemi3@users.noreply.github.com> Date: Wed, 27 Sep 2023 05:00:08 +0000 Subject: [PATCH 1/2] 26244 added documentation --- galleries/users_explain/colors/colormaps.py | 5 +++++ lib/matplotlib/colors.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/colors.py b/lib/matplotlib/colors.py index 904b6ecfa04b..567126f6c891 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -114,6 +114,11 @@ class ColorSequenceRegistry(Mapping): `.ColorSequenceRegistry.register`:: mpl.color_sequences.register('rgb', ['r', 'g', 'b']) + + To get a list of all registered colormaps, you can do:: + + from matplotlib import colormaps + list(colormaps) """ _BUILTIN_COLOR_SEQUENCES = { From d5bada18230328f0cbddac8d92d56f4b1cec340c Mon Sep 17 00:00:00 2001 From: wemi3 <62965919+wemi3@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:34:52 +0000 Subject: [PATCH 2/2] Fixed edit on incorrect document --- lib/matplotlib/cm.py | 5 +++++ lib/matplotlib/colors.py | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) 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 diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 567126f6c891..904b6ecfa04b 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -114,11 +114,6 @@ class ColorSequenceRegistry(Mapping): `.ColorSequenceRegistry.register`:: mpl.color_sequences.register('rgb', ['r', 'g', 'b']) - - To get a list of all registered colormaps, you can do:: - - from matplotlib import colormaps - list(colormaps) """ _BUILTIN_COLOR_SEQUENCES = {