I have a list (or np.array
) of values that lie between 0 and 1, e.g.
_list = np.arange(0, 1, 0.05)
print(_list)
>>>
[0. 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65
0.7 0.75 0.8 0.85 0.9 0.95]
How can I map a smooth color gradient to this list, where 0 represents the color white (rgb(255,255,255)
) and 1 represents the color red (rgb(255,0,0)
), and all other values in between a color in between?
I have checked matplotlib.colors
but I cannot find anything related there. I have found local topics that discuss similar things but they are all related to plotting. Am I missing something, or is it really not that trivial?