8000 Improve API note · matplotlib/matplotlib@84daf24 · GitHub
[go: up one dir, main page]

Skip to content

Commit 84daf24

Browse files
dstansbytimhoffm
andauthored
Improve API note
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent a5a4846 commit 84daf24

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
``matplotlib.cm.get_cmap``
22
~~~~~~~~~~~~~~~~~~~~~~~~~~
33

4-
If you have the name of a colormap as a `str`, use ``matplotlib.colormaps[name]`` instead.
4+
Colormaps are now available through the `.Coloarmap.Registry` accessible via
5+
``matplotlib.colormaps`` or ``plt.colormaps``.
56

6-
Otherwise `matplotlib.cm.ColormapRegistry.get_cmap` if you have a `str`, `None` or a
7-
`matplotlib.colors.Colormap` object that you want to convert to a `.Colormap` object.
7+
If you have the name of a colormap as a sting, you can use direct lookup
8+
``matplotlib.colormaps[name]``. Alternatively, `matplotlib.colormaps.get_cmap` will
9+
maintain the existing behavior of additionally passing through `.Colormap` instances
10+
and converting ``None`` to the default colormap. `plt.get_cmap` will stay as a
11+
shortcut to `matplotlib.colormaps.get_cmap`.

0 commit comments

Comments
 (0)
0