Skip to content

Commit d37679e

Browse files
committed
rename annotation to hovertext
1 parent c7c27b6 commit d37679e

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Diff for: plotly/figure_factory/_dendrogram.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
def create_dendrogram(X, orientation="bottom", labels=None,
1818
colorscale=None, distfun=None,
1919
linkagefun=lambda x: sch.linkage(x, 'complete'),
20-
annotation=None):
20+
hovertext=None):
2121
"""
2222
BETA function that returns a dendrogram Plotly figure object.
2323
@@ -29,6 +29,7 @@ def create_dendrogram(X, orientation="bottom", labels=None,
2929
the observations
3030
:param (function) linkagefun: Function to compute the linkage matrix from
3131
the pairwise distances
32+
:param (list[list]) hovertext: List of hovertext for constituent traces of dendrogram
3233
3334
clusters
3435
@@ -87,7 +88,7 @@ def create_dendrogram(X, orientation="bottom", labels=None,
8788

8889
dendrogram = _Dendrogram(X, orientation, labels, colorscale,
8990
distfun=distfun, linkagefun=linkagefun,
90-
annotation=annotation)
91+
hovertext=hovertext)
9192

9293
return {'layout': dendrogram.layout,
9394
'data': dendrogram.data}
@@ -100,7 +101,7 @@ def __init__(self, X, orientation='bottom', labels=None, colorscale=None,
100101
width="100%", height="100%", xaxis='xaxis', yaxis='yaxis',
101102
distfun=None,
102103
linkagefun=lambda x: sch.linkage(x, 'complete'),
103-
annotation=None):
104+
hovertext=None):
104105
self.orientation = orientation
105106
self.labels = labels
106107
self.xaxis = xaxis
@@ -127,7 +128,7 @@ def __init__(self, X, orientation='bottom', labels=None, colorscale=None,
127128
ordered_labels, leaves) = self.get_dendrogram_traces(X, colorscale,
128129
distfun,
129130
linkagefun,
130-
annotation)
131+
hovertext)
131132

132133
self.labels = ordered_labels
133134
self.leaves = leaves
@@ -236,7 +237,7 @@ def set_figure_layout(self, width, height):
236237

237238
return self.layout
238239

239-
def get_dendrogram_traces(self, X, colorscale, distfun, linkagefun, annotation):
240+
def get_dendrogram_traces(self, X, colorscale, distfun, linkagefun, hovertext):
240241
"""
241242
Calculates all the elements needed for plotting a dendrogram.
242243
@@ -246,6 +247,7 @@ def get_dendrogram_traces(self, X, colorscale, distfun, linkagefun, annotation):
246247
from the observations
247248
:param (function) linkagefun: Function to compute the linkage matrix
248249
from the pairwise distances
250+
:param (list) hovertext: List of hovertext for constituent traces of dendrogram
249251
:rtype (tuple): Contains all the traces in the following order:
250252
(a) trace_list: List of Plotly trace objects for dendrogram tree
251253
(b) icoord: All X points of the dendrogram tree as array of arrays
@@ -283,15 +285,15 @@ def get_dendrogram_traces(self, X, colorscale, distfun, linkagefun, annotation):
283285
else:
284286
ys = icoord[i]
285287
color_key = color_list[i]
286-
text_annotation = None
287-
if annotation:
288-
text_annotation = annotation[i]
288+
hovertext_label = None
289+
if hovertext:
290+
hovertext_label = hovertext[i]
289291
trace = graph_objs.Scatter(
290292
x=np.multiply(self.sign[self.xaxis], xs),
291293
y=np.multiply(self.sign[self.yaxis], ys),
292294
mode='lines',
293295
marker=graph_objs.Marker(color=colors[color_key]),
294-
text=text_annotation,
296+
text=hovertext_label,
295297
hoverinfo='text'
296298
)
297299

0 commit comments

Comments
 (0)