I want to statically define a mapping for a value to a color. My values are orange, banana, apple (categoricals) . However they don't always all appear together. The following will map the first appearing value to red, second to yellow and so on.
matplotlib.colors.ListedColormap('red','yellow','green')
I am looking for something like this:
matplotlib.colors.ListedColormap({'red':'orange',
'yellow':'banana',
'green':'apple')
However, the later just transforms the keys of that dictionary to a list, resulting in the first ...
I am doing a heatmap where I want to color the background accordingly