Answers for "matplotlib convert color string to int"

0

matplotlib convert color string to int

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
Posted by: Guest on August-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language