Python: how to create a colorbar based on a list of values?

474 Views Asked by At

I have to fill some patches with certain color based on given values. I have a data frame that looks like the following:

df:

   Val  Patch
0   12  0
1   13  1
2   16  2
3   18  3
4   19  4
5   24  5
6   31  6
7   33  7
8   34  8
9   35  9

I would like to know how to create associate to each values the "right" color in a colorbar (of reds for instance).

cmap = plt.cm.Reds

0

There are 0 best solutions below