MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / set_cmap

Function set_cmap

lib/matplotlib/pyplot.py:2736–2756  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2734
2735
2736def 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)

Callers 15

autumnFunction · 0.85
boneFunction · 0.85
coolFunction · 0.85
copperFunction · 0.85
flagFunction · 0.85
grayFunction · 0.85
hotFunction · 0.85
hsvFunction · 0.85
jetFunction · 0.85
pinkFunction · 0.85
prismFunction · 0.85
springFunction · 0.85

Calls 4

get_cmapFunction · 0.85
gciFunction · 0.85
rcFunction · 0.70
set_cmapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…