@@ -25,36 +25,22 @@ def create_dendrogram(
25
25
color_threshold = None ,
26
26
):
27
27
"""
28
- Function that returns a dendrogram Plotly figure object.
28
+ Function that returns a dendrogram Plotly figure object. This is a thin
29
+ wrapper around scipy.cluster.hierarchy.dendrogram.
29
30
30
31
See also https://dash.plot.ly/dash-bio/clustergram.
31
32
32
33
:param (ndarray) X: Matrix of observations as array of arrays
33
34
:param (str) orientation: 'top', 'right', 'bottom', or 'left'
34
35
:param (list) labels: List of axis category labels(observation labels)
35
- :param (list) colorscale: Optional colorscale for dendrogram tree. To
36
- totally replace the default colorscale, a custom
37
- colorscale must contain 8 colors, corresponding
38
- to when the underlying
39
- scipy.cluster.hierarchy.dendrogram specifies
40
- 'b', 'c', 'g', 'k', 'm', 'r', 'w', 'y', in that
41
- order. So if you want 'b', 'c', 'g', 'k', to map
42
- to rgb(255,0,0) and 'm', 'r', 'w', 'y', to map
43
- to rgb(0,255,0), the colorscale should be
44
- ['rgb(255,0,0)','rgb(255,0,0)','rgb(255,0,0)',
45
- 'rgb(255,0,0)','rgb(0,255,0)','rgb(0,255,0)',
46
- 'rgb(0,255,0)','rgb(0,255,0)',] If using
47
- scipy >= 1.5.1, instead of the letters above, the
48
- colors are specfied as 'C0', 'C1', etc. and in
49
- that case the list corresponds to the colors:
50
- 'C0', 'C3' or 'C9', 'C1' or 'C7', 'C6', 'C2',
51
- 'C4', 'C8',<ignored>, 'C5', 'C7', e.g., if
52
- scipy.cluster.hierarchy.dendrogram uses the color
53
- 'C3' or 'C9' this is mapped to the rgb value in
54
- index 1, and there is not color that maps to index
55
- 7, of the colorscale. If the colorscale has less
56
- than 8 colors, the remaining colors remain the
57
- default.
36
+ :param (list) colorscale: Optional colorscale for the dendrogram tree. With
37
+ scipy<=1.4.1 requires 8 colors to be specified,
38
+ the 7th of which is ignored. With scipy>=1.5.0,
39
+ requires 10 colors. In this case the 8th color is
40
+ ignored and the 2nd, 3rd and 6th are used twice as
41
+ often as the others. Given a shorter list, the
42
+ missing values are replaced with defaults and with
43
+ a longer list the extra values are ignored.
58
44
:param (function) distfun: Function to compute the pairwise distance from
59
45
the observations
60
46
:param (function) linkagefun: Function to compute the linkage matrix from
0 commit comments