matplotlib.colors.to_rgba#

matplotlib.colors.to_rgba(c, alpha=None)[源代码][源代码]#

c 转换为 RGBA 颜色。

参数:
c : Matplotlib 颜色或 np.ma.maskedMatplotlib 颜色或
alpha浮点数,可选

如果给出了 alpha ,则强制返回的 RGBA 元组的 alpha 值为 alpha

如果为 None,则使用 c 中的 alpha 值。如果 c 没有 alpha 通道,则 alpha 默认为 1。

alpha 对于颜色值 "none"``(不区分大小写)会被忽略,它总是映射到 ``(0, 0, 0, 0)

返回:
元组

浮点数元组 (r, g, b, a) ,其中每个通道(红色、绿色、蓝色、alpha)的值可以在0到1之间。

使用 matplotlib.colors.to_rgba 的示例#

命名颜色列表

List of named colors