Skip to content

Commit

Permalink
Backport PR matplotlib#26930: Added documentation on getting full lis…
Browse files Browse the repository at this point in the history
…t of registered colormaps re: issue matplotlib#26244
  • Loading branch information
wemi3 authored and meeseeksmachine committed Oct 17, 2023
1 parent da2f9e2 commit f828f1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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

0 comments on commit f828f1e

Please sign in to comment.