📜  matplotlib 将颜色字符串转换为 int - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:22.984000             🧑  作者: Mango

代码示例1
from matplotlib.colors import CSS4_COLORS, to_rgb

# Convert the color 'red' to rgb format:
c = to_rgb(CSS4_COLORS["red"]) # c = (1, 0, 0)

# For all available colors go to: 
# https://matplotlib.org/3.3.1/gallery/color/named_colors.html#sphx-glr-gallery-color-named-colors-py