Set the default colormap, and applies it to the current image if any. Parameters ---------- cmap : `~matplotlib.colors.Colormap` or str A colormap instance or the name of a registered colormap. See Also -------- colormaps get_cmap
(cmap: Colormap | str)
| 2734 | |
| 2735 | |
| 2736 | def set_cmap(cmap: Colormap | str) -> None: |
| 2737 | """ |
| 2738 | Set the default colormap, and applies it to the current image if any. |
| 2739 | |
| 2740 | Parameters |
| 2741 | ---------- |
| 2742 | cmap : `~matplotlib.colors.Colormap` or str |
| 2743 | A colormap instance or the name of a registered colormap. |
| 2744 | |
| 2745 | See Also |
| 2746 | -------- |
| 2747 | colormaps |
| 2748 | get_cmap |
| 2749 | """ |
| 2750 | cmap = get_cmap(cmap) |
| 2751 | |
| 2752 | rc('image', cmap=cmap.name) |
| 2753 | im = gci() |
| 2754 | |
| 2755 | if im is not None: |
| 2756 | im.set_cmap(cmap) |
| 2757 | |
| 2758 | |
| 2759 | @_copy_docstring_and_deprecators(matplotlib.image.imread) |
no test coverage detected
searching dependent graphs…