Skip to content

Commit 409d5b7

Browse files
committed
update docstring
1 parent 5e58811 commit 409d5b7

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

packages/python/plotly/plotly/figure_factory/_annotated_heatmap.py

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,46 +57,50 @@ def create_annotated_heatmap(
5757
**kwargs,
5858
):
5959
"""
60-
**deprecated**, use instead
61-
:func:`plotly.express.imshow`.
60+
**Deprecated**. Use [`plotly.express.imshow`][plotly.express.imshow] instead.
6261
63-
Function that creates annotated heatmaps
62+
Function that creates annotated heatmaps.
6463
6564
This function adds annotations to each cell of the heatmap.
6665
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-
66+
Parameters
67+
----------
68+
z : list of list or ndarray
69+
z matrix to create heatmap.
70+
x : list
71+
x axis labels.
72+
y : list
73+
y axis labels.
74+
annotation_text : list of list or ndarray
75+
Text strings for annotations. Should have the same dimensions as the z matrix. If no
76+
text is added, the values of the z matrix are annotated. Default is the z matrix values.
77+
colorscale : list or str
78+
Heatmap colorscale.
79+
font_colors : list
80+
List of two color strings: [min_text_color, max_text_color] where min_text_color is applied to annotations for
81+
heatmap values < (max_value - min_value)/2. If font_colors is not defined, the colors are defined logically as
82+
black or white depending on the heatmap's colorscale.
83+
showscale : bool
84+
Display colorscale. Default is False.
85+
reversescale : bool
86+
Reverse colorscale. Default is False.
87+
**kwargs
88+
Additional keyword arguments passed through to `plotly.graph_objs.Heatmap`.
89+
These kwargs describe other attributes about the annotated Heatmap trace such as the colorscale.
90+
For more information on valid kwargs, call `help(plotly.graph_objs.Heatmap)`.
91+
92+
Examples
93+
--------
8794
Example 1: Simple annotated heatmap with default configuration
8895
8996
>>> import plotly.figure_factory as ff
90-
9197
>>> z = [[0.300000, 0.00000, 0.65, 0.300000],
9298
... [1, 0.100005, 0.45, 0.4300],
9399
... [0.300000, 0.00000, 0.65, 0.300000],
94100
... [1, 0.100005, 0.45, 0.00000]]
95-
96101
>>> fig = ff.create_annotated_heatmap(z)
97102
>>> fig.show()
98103
"""
99-
100104
# Avoiding mutables in the call signature
101105
font_colors = font_colors if font_colors is not None else []
102106
validate_annotated_heatmap(z, x, y, annotation_text)
@@ -173,7 +177,6 @@ class _AnnotatedHeatmap(object):
173177
def __init__(
174178
self, z, x, y, annotation_text, colorscale, font_colors, reversescale, **kwargs
175179
):
176-
177180
self.z = z
178181
if x:
179182
self.x = x
@@ -261,7 +264,6 @@ def get_text_color(self):
261264
min_text_color = black
262265
max_text_color = white
263266
elif isinstance(self.colorscale, list):
264-
265267
min_col = to_rgb_color_list(self.colorscale[0][1], [255, 255, 255])
266268
max_col = to_rgb_color_list(self.colorscale[-1][1], [255, 255, 255])
267269

0 commit comments

Comments
 (0)