Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Error Showing Text Labels in Heatmap

I am trying to render text labels on a Heatmap. I have verified that I am running the latest version of Plotly (5.5.0), and am using the example code in the “Text on Heatmap Points” section on the Heatmaps webpage (Heatmaps). My code looks like the following:

from dash import Dash, dcc, html
import plotly.graph_objects as go

figHeatmap = go.Figure(
                                       z=[[1,20,30], [20,1,60], [30,60,1]],

# app = Dash()
# app.layout = html.Div([
#     dcc.Graph(figure=figHeatmap)
# ])
# if __name__=='__main__':
#     app.run_server()

My code is part of a Dash app, and when I run the application what I see is this:

whereas what I expect to see, according to the Heatmap webpage is this:

However, when I run the example interactively, and use, it does indeed work as expected. Therefore, I believe that my issue is with Dash and not with Plotly. Would that be a fair assessment? In any case, can anyone help me get the labels to show on the Heatmap when used in a Dash app? The labels do show on hover, but I’m looking for text labels without hovering.


hi @shwiftyRick
Welcome to the Dash community.

Thank you for reporting this. I agree, this seems a bit odd. The graph displays differently when run with Dash. Let me check with the team and get back to you later this week with an answer.

Have a good day,

Thank you @adamschroeder I appreciate your help!

Hi @adamschroeder, I just want to check in to see if there’s any news from the team about this?

hi @shwiftyRick
Sending you a private message right now. Still trying to figure this out. I’ll also post here the final answer publicly once we get it.