Skip to content

Commit 1ed30d0

Browse files
wemi3meeseeksmachine
authored andcommitted
Backport PR #26930: Added documentation on getting full list of registered colormaps re: issue #26244
1 parent 97e8d17 commit 1ed30d0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

galleries/users_explain/colors/colormaps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
help on creating your own colormaps, see
1616
:ref:`colormap-manipulation`.
1717
18+
To get a list of all registered colormaps, you can do::
19+
20+
from matplotlib import colormaps
21+
list(colormaps)
22+
1823
Overview
1924
========
2025

lib/matplotlib/cm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ class ColormapRegistry(Mapping):
7474
Additional colormaps can be added via `.ColormapRegistry.register`::
7575
7676
mpl.colormaps.register(my_colormap)
77+
78+
To get a list of all registered colormaps, you can do::
79+
80+
from matplotlib import colormaps
81+
list(colormaps)
7782
"""
7883
def __init__(self, cmaps):
7984
self._cmaps = cmaps

0 commit comments

Comments
 (0)