matplotlib.pyplot.get_cmap#

matplotlib.pyplot.get_cmap(name=None, lut=None)[源代码][源代码]#

获取一个颜色映射实例,如果 name 为 None,则默认为 rc 值。

参数:
名称 : Colormap 或 str 或 None, 默认: NoneColormap 或 str 或 None, 默认: None

如果是一个 Colormap 实例,它将被返回。否则,将返回一个 Matplotlib 已知的色图名称,该色图将由 lut 重新采样。默认值 None 表示 rcParams["image.cmap"] (default: 'viridis')。

lutint 或 None, 默认: None

如果 name 还不是 Colormap 实例且 lut 不为 None,则会将 colormap 重新采样,使其在查找表中具有 lut 个条目。

返回:
色图

使用 matplotlib.pyplot.get_cmap 的示例#

图像重采样

Image resampling

3D 中的 2D 图像

2D images in 3D

相交的平面

Intersecting planes

pie(x)

pie(x)