matplotlib.colors.from_levels_and_colors#

matplotlib.colors.from_levels_and_colors(levels, colors, extend='neither')[源代码][源代码]#

一个辅助例程,用于生成一个 cmap 和 norm 实例,其行为类似于 contourf 的 levels 和 colors 参数。

参数:
级别数字序列

用于构建 BoundaryNorm 的量化级别。如果 lev[i] <= v < lev[i+1],则值 v 被量化为级别 i

颜色颜色序列

每个级别使用的填充颜色。如果 extend 是 "neither",则必须有 n_level - 1 种颜色。对于 extend 为 "min" 或 "max",添加一种额外的颜色,对于 extend 为 "both",添加两种颜色。

扩展{'neither', 'min', 'max', 'both'}, 可选

当值超出给定级别范围时的行为。详情请参见 contourf

返回:
cmap颜色映射
norm标准化