plotly.figure_factory
.create_annotated_heatmap¶
-
plotly.figure_factory.
create_annotated_heatmap
(z, x=None, y=None, annotation_text=None, colorscale='Plasma', font_colors=None, showscale=False, reversescale=False, **kwargs)¶ deprecated, use instead
plotly.express.imshow()
.Function that creates annotated heatmaps
This function adds annotations to each cell of the heatmap.
- Parameters
x ((list)) – x axis labels.
y ((list)) – y axis labels.
annotation_text ((list[list]|ndarray)) – Text strings for annotations. Should have the same dimensions as the z matrix. If no text is added, the values of the z matrix are annotated. Default = z matrix values.
colorscale ((list|str)) – heatmap colorscale.
font_colors ((list)) – List of two color strings: [min_text_color, max_text_color] where min_text_color is applied to annotations for heatmap values < (max_value - min_value)/2. If font_colors is not defined, the colors are defined logically as black or white depending on the heatmap’s colorscale.
showscale ((bool)) – Display colorscale. Default = False
reversescale ((bool)) – Reverse colorscale. Default = False
kwargs – kwargs passed through plotly.graph_objects.Heatmap. These kwargs describe other attributes about the annotated Heatmap trace such as the colorscale. For more information on valid kwargs call help(plotly.graph_objects.Heatmap)
Example 1: Simple annotated heatmap with default configuration
>>> import plotly.figure_factory as ff
>>> z = [[0.300000, 0.00000, 0.65, 0.300000], ... [1, 0.100005, 0.45, 0.4300], ... [0.300000, 0.00000, 0.65, 0.300000], ... [1, 0.100005, 0.45, 0.00000]]
>>> fig = ff.create_annotated_heatmap(z) >>> fig.show()