matplotlib.colors.Colormap¶
-
class
matplotlib.colors.
Colormap
(name, N=256)[源代码]¶ 基类:
object
所有标量到rgba映射的基类。
通常,Colormap实例用于转换间隔中的数据值(float)
[0, 1]
到相应颜色映射所表示的rgba颜色。用于将数据扩展到[0, 1]
区间见matplotlib.colors.Normalize
. 亚类matplotlib.cm.ScalarMappable
好好利用这个data -> normalize -> map-to-color
处理链。参数: - nameSTR
颜色映射的名称。
- N利息
RGB量化级别的数目。
-
__call__
(X, alpha=None, bytes=False)[源代码]¶ 参数: - Xfloat或int,ndarray或scalar
要转换为RGBA的数据值。对于浮动,X应该在间隔中
[0.0, 1.0]
返回RGBA值X*100
沿颜色映射线的百分比。对于整数,X应该在区间内[0, Colormap.N)
返回RGBA值 索引的 从带有索引的ColormapX
.- alpha浮动,无
Alpha必须是介于0和1之间的标量,或者为零。
- bytes布尔
如果为False(默认),则返回的RGBA值将在间隔中浮动
[0, 1]
否则,它们将在间隔中为uint8s[0, 255]
.
返回: - 如果X是标量,则为RGBA值的元组,否则为
- 形状为的RGBA值
X.shape + (4, )
.
-
__dict__
= mappingproxy({'__module__': 'matplotlib.colors', '__doc__': '\n Baseclass for all scalar to RGBA mappings.\n\n Typically, Colormap instances are used to convert data values (floats)\n from the interval ``[0, 1]`` to the RGBA color that the respective\n Colormap represents. For scaling of data into the ``[0, 1]`` interval see\n `matplotlib.colors.Normalize`. Subclasses of `matplotlib.cm.ScalarMappable`\n make heavy use of this ``data -> normalize -> map-to-color`` processing\n chain.\n ', '__init__': <function Colormap.__init__>, '__call__': <function Colormap.__call__>, '__copy__': <function Colormap.__copy__>, 'set_bad': <function Colormap.set_bad>, 'set_under': <function Colormap.set_under>, 'set_over': <function Colormap.set_over>, '_set_extremes': <function Colormap._set_extremes>, '_init': <function Colormap._init>, 'is_gray': <function Colormap.is_gray>, '_resample': <function Colormap._resample>, 'reversed': <function Colormap.reversed>, '__dict__': <attribute '__dict__' of 'Colormap' objects>, '__weakref__': <attribute '__weakref__' of 'Colormap' objects>, '__annotations__': {}})¶
-
__module__
= 'matplotlib.colors'¶
-
__weakref__
¶ 对象的弱引用列表(如果已定义)
-
colorbar_extend
¶ 当此颜色映射存在于标量映射表上且颜色条扩展不为假时,颜色条创建将
colorbar_extend
作为默认值extend
关键字在matplotlib.colorbar.Colorbar
建造师。