matplotlib heatmap with discrete values with custom defined colors

Viewed 830

i'm trying to generate a heatmap with custom colors for each cell based on the values in Python.

data = [ [0,3,2,5],[2,3,3,0],...,[0,0,2,2]]
colors = {0:'red',2:'blue',3:'green',5:'purple'}

Anyone could help?

1 Answers
Related