Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Backport PR #26930: Added documentation on getting full list of regis…
…tered colormaps re: issue #26244
  • Loading branch information
wemi3 authored and meeseeksmachine committed Oct 17, 2023
commit 1ed30d033847240093072b714447c33bf616e1ae
5 changes: 5 additions & 0 deletions galleries/users_explain/colors/colormaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
========

Expand Down
5 changes: 5 additions & 0 deletions lib/matplotlib/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down