Edit
It's now possible to do it easily with plotly.figure_factory:
https://plot.ly/python/annotated_heatmap/
As far as I know, it is still not possible to convert Matplotlib's heatmaps into Plotly's though.
Aug 2015 Answer
Here's an example of making an annotated heatmap with the python api:
import plotly.plotly as py
import plotly.graph_objs as go
x = ['A', 'B', 'C', 'D', 'E']
y = ['W', 'X', 'Y', 'Z']
# x0 x1 x2 x3 x4
z = [[0.00, 0.00, 0.75, 0.75, 0.00], # y0
[0.00, 0.00, 0.75, 0.75, 0.00], # y1
[0.75, 0.75, 0.75, 0.75, 0.75], # y2
[0.00, 0.00, 0.00, 0.75, 0.00]] # y3
annotations = go.Annotations()
for n, row in enumerate(z):
for m, val in enumerate(row):
annotations.append(go.Annotation(text=str(z[n][m]), x=x[m], y=y[n],
xref='x1', yref='y1', showarrow=False))
colorscale = [[0, '#3D9970'], [1, '#001f3f']] # custom colorscale
trace = go.Heatmap(x=x, y=y, z=z, colorscale=colorscale, showscale=False)
fig = go.Figure(data=go.Data([trace]))
fig['layout'].update(
title="Annotated Heatmap",
annotations=annotations,
xaxis=go.XAxis(ticks='', side='top'),
yaxis=go.YAxis(ticks='', ticksuffix=' '), # ticksuffix is a workaround to add a bit of padding
width=700,
height=700,
autosize=False
)
print py.plot(fig, filename='Stack Overflow 31756636', auto_open=False) # https://plot.ly/~theengineear/5179
With the result at https://plot.ly/~theengineear/5179

Linking a related GitHub issue: https://github.com/plotly/python-api/issues/273
Answer from theengineear on Stack OverflowEdit
It's now possible to do it easily with plotly.figure_factory:
https://plot.ly/python/annotated_heatmap/
As far as I know, it is still not possible to convert Matplotlib's heatmaps into Plotly's though.
Aug 2015 Answer
Here's an example of making an annotated heatmap with the python api:
import plotly.plotly as py
import plotly.graph_objs as go
x = ['A', 'B', 'C', 'D', 'E']
y = ['W', 'X', 'Y', 'Z']
# x0 x1 x2 x3 x4
z = [[0.00, 0.00, 0.75, 0.75, 0.00], # y0
[0.00, 0.00, 0.75, 0.75, 0.00], # y1
[0.75, 0.75, 0.75, 0.75, 0.75], # y2
[0.00, 0.00, 0.00, 0.75, 0.00]] # y3
annotations = go.Annotations()
for n, row in enumerate(z):
for m, val in enumerate(row):
annotations.append(go.Annotation(text=str(z[n][m]), x=x[m], y=y[n],
xref='x1', yref='y1', showarrow=False))
colorscale = [[0, '#3D9970'], [1, '#001f3f']] # custom colorscale
trace = go.Heatmap(x=x, y=y, z=z, colorscale=colorscale, showscale=False)
fig = go.Figure(data=go.Data([trace]))
fig['layout'].update(
title="Annotated Heatmap",
annotations=annotations,
xaxis=go.XAxis(ticks='', side='top'),
yaxis=go.YAxis(ticks='', ticksuffix=' '), # ticksuffix is a workaround to add a bit of padding
width=700,
height=700,
autosize=False
)
print py.plot(fig, filename='Stack Overflow 31756636', auto_open=False) # https://plot.ly/~theengineear/5179
With the result at https://plot.ly/~theengineear/5179

Linking a related GitHub issue: https://github.com/plotly/python-api/issues/273
You have to use Plotly's declarative syntax, instead of converting from matplotlib to Python. Plotly only supports the matplotlib figure objects that it can reverse engineer, and unfortunately heatmaps aren't one of them. Here are the Plotly Python heatmap docs: https://plot.ly/python/heatmaps/ And here are the Plotly Python annotation docs: https://plot.ly/python/text-and-annotations/ Make sure to set the annotations to be referenced to the data rather than the page.
You could also overlay a scatter plot with a hover text field on the heatmap, but set the mode of the scatter plot to text. This would make only the text show and not the scatter plot points. Docs: https://plot.ly/python/text-and-annotations/