**deprecated**, use instead :func:`plotly.express.imshow`. Function that creates annotated heatmaps This function adds annotations to each cell of the heatmap. :param (list[list]|ndarray) z: z matrix to create heatmap. :param (list) x: x axis labels. :param (list) y:
(
z,
x=None,
y=None,
annotation_text=None,
colorscale="Plasma",
font_colors=None,
showscale=False,
reversescale=False,
**kwargs,
)
| 46 | |
| 47 | |
| 48 | def create_annotated_heatmap( |
| 49 | z, |
| 50 | x=None, |
| 51 | y=None, |
| 52 | annotation_text=None, |
| 53 | colorscale="Plasma", |
| 54 | font_colors=None, |
| 55 | showscale=False, |
| 56 | reversescale=False, |
| 57 | **kwargs, |
| 58 | ): |
| 59 | """ |
| 60 | **deprecated**, use instead |
| 61 | :func:`plotly.express.imshow`. |
| 62 | |
| 63 | Function that creates annotated heatmaps |
| 64 | |
| 65 | This function adds annotations to each cell of the heatmap. |
| 66 | |
| 67 | :param (list[list]|ndarray) z: z matrix to create heatmap. |
| 68 | :param (list) x: x axis labels. |
| 69 | :param (list) y: y axis labels. |
| 70 | :param (list[list]|ndarray) annotation_text: Text strings for |
| 71 | annotations. Should have the same dimensions as the z matrix. If no |
| 72 | text is added, the values of the z matrix are annotated. Default = |
| 73 | z matrix values. |
| 74 | :param (list|str) colorscale: heatmap colorscale. |
| 75 | :param (list) font_colors: List of two color strings: [min_text_color, |
| 76 | max_text_color] where min_text_color is applied to annotations for |
| 77 | heatmap values < (max_value - min_value)/2. If font_colors is not |
| 78 | defined, the colors are defined logically as black or white |
| 79 | depending on the heatmap's colorscale. |
| 80 | :param (bool) showscale: Display colorscale. Default = False |
| 81 | :param (bool) reversescale: Reverse colorscale. Default = False |
| 82 | :param kwargs: kwargs passed through plotly.graph_objs.Heatmap. |
| 83 | These kwargs describe other attributes about the annotated Heatmap |
| 84 | trace such as the colorscale. For more information on valid kwargs |
| 85 | call help(plotly.graph_objs.Heatmap) |
| 86 | |
| 87 | Example 1: Simple annotated heatmap with default configuration |
| 88 | |
| 89 | >>> import plotly.figure_factory as ff |
| 90 | |
| 91 | >>> z = [[0.300000, 0.00000, 0.65, 0.300000], |
| 92 | ... [1, 0.100005, 0.45, 0.4300], |
| 93 | ... [0.300000, 0.00000, 0.65, 0.300000], |
| 94 | ... [1, 0.100005, 0.45, 0.00000]] |
| 95 | |
| 96 | >>> fig = ff.create_annotated_heatmap(z) |
| 97 | >>> fig.show() |
| 98 | """ |
| 99 | |
| 100 | # Avoiding mutables in the call signature |
| 101 | font_colors = font_colors if font_colors is not None else [] |
| 102 | validate_annotated_heatmap(z, x, y, annotation_text) |
| 103 | |
| 104 | # validate colorscale |
| 105 | colorscale_validator = ValidatorCache.get_validator("heatmap", "colorscale") |
no test coverage detected