How to add annotations to a heatmap?

I have a pretty standard heatmap and I cannot figure out how to add for each box the z-value as a label. Not just as hover but fixed on the heatmap. I am using plotly in what I think is a pretty standard way. I couldn’t figure it out from the doc. Here is the code:


layout=go.Layout(title=‘My Data’,autosize=False,
width=700, height=600,
xaxis = dict(
tickmode = ‘linear’,
dtick = 1))


Thank you for any help!


Hi @pbecker126,

Take a look at these tutorials:

Thank you Empet! That worked. I had to switch to the Figure Factory Annotated Heatmap, and change the format of the x,y,z lists but I got it to work.

Followon question. If I want to add some divider lines (maybe they are called splines?) in my figure, to separate sections of the heatmap, is there a way to do that?

Thanks again.

@pbecker126 when fig = ff… is already defined.
update the heatmap as follow:[0].update(xgap=1, ygap=1)