Hello everyone
I used plotly.figure_factory
to plot the following heatmap:
But what I want is to colorscale each column individually. Something like this:

(done in Excel)
Notice how for example in column A, the highest value 52 [A4] is darkest among column A, and value 30 [A2] is lightest, while in column D the highest value 34 [D5] is darkest among column D, and the value 8 D[3] is the lightest.
Can this be achievable in plotly?
Thank for you very much in advance!
I actually managed to do it with the help of this answer. I.e. by scaling each column by its max
value, and providing the raw values in the โtextโ and annotation_text
arguments:
def _scale(column, new_range):
old_range = (column.min(), column.max())
return (((column - old_range[0]) * (new_range[1] - new_range[0])) / (old_range[1] - old_range[0])) + new_range[0]
ff.create_annotated_heatmap(z=(hm.apply(lambda col: _scale(col, (0, 1)))).values,
annotation_text=hm.values,
text=hm.values,
x=hm.columns.to_list(),
y=hm.index.to_list(),
hoverinfo='x+y+text',
colorscale='Blues')