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')