Plotting dendrograms
Convenience wrapper
idendrogram.Dendrogram.plot(...)
Plot the dendrogram using one of the supported backends. This is a convenience function,
you can also use to_*()
functions from appropriate target backends at idendrogram.targets.[backend].to_[backend]()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
backend |
str
|
Backend to use, one of 'altair', 'streamlit', 'plotly', 'matplotlib'. |
'altair'
|
orientation |
str
|
Position of dendrogram's root node. One of "top", "bottom", "left", "right". |
'top'
|
show_nodes |
bool
|
Whether to draw nodes. |
True
|
height |
float
|
Height of the dendrogram. |
400
|
width |
float
|
Width of the dendrogram. |
400
|
scale |
str
|
Scale used for the value axis. One of "linear", "symlog", "log". |
'linear'
|
Raises:
Type | Description |
---|---|
ValueError
|
Parameters supplied did not comform to allowed values. |
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
Varies by backend:
|
Source code in idendrogram/containers.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
Backend-specific functions
idendrogram.targets.altair.to_altair(...)
Converts a dendrogram object into Altair chart.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dendrogram |
Dendrogram
|
idendrogram dendrogram object |
required |
orientation |
str
|
Position of dendrogram's root node. One of "top", "bottom", "left", "right". Defaults to "top". |
'top'
|
show_nodes |
bool
|
Whether to draw nodes. Defaults to True. |
True
|
height |
float
|
Height of the dendrogram. Defaults to 400. |
400
|
width |
float
|
Width of the dendrogram. Defaults to 400. |
400
|
scale |
str
|
Scale used for the value axis. One of "linear", "symlog", "log". Defaults to 'linear'. |
'linear'
|
Returns:
Type | Description |
---|---|
alt.LayerChart
|
Altair chart object |
Source code in idendrogram/targets/altair.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
idendrogram.targets.altair.to_plotly(...)
Converts a dendrogram object into Plotly chart
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dendrogram |
Dendrogram
|
idendrogram dendrogram object |
required |
orientation |
str
|
Position of dendrogram's root node. One of "top", "bottom", "left", "right". Defaults to "top". |
'top'
|
show_nodes |
bool
|
Whether to draw nodes. Defaults to True. |
True
|
height |
float
|
Height of the dendrogram. Defaults to 400. |
400
|
width |
float
|
Width of the dendrogram. Defaults to 400. |
400
|
scale |
str
|
Scale used for the value axis. One of "linear", "log". "symlog" is not supported by Plotly. Defaults to 'linear'. |
'linear'
|
Returns:
Type | Description |
---|---|
Any
|
plotly.graph_objs.Figure: Plotly figure object |
Source code in idendrogram/targets/plotly.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
idendrogram.targets.altair.to_matplotlib(...)
Converts a dendrogram object into matplotlib chart
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dendrogram |
Dendrogram
|
idendrogram dendrogram object |
required |
orientation |
str
|
Position of dendrogram's root node. One of "top", "bottom", "left", "right". Defaults to "top". |
'top'
|
show_nodes |
bool
|
Whether to draw nodes. Defaults to True. |
True
|
height |
float
|
Height of the dendrogram. Defaults to 400. |
400
|
width |
float
|
Width of the dendrogram. Defaults to 400. |
400
|
scale |
str
|
Scale used for the value axis. One of "linear", "symlog", "log". Defaults to 'linear'. |
'linear'
|
Returns:
Type | Description |
---|---|
Axes
|
matplotlib.pyplot.ax: matplotlib axes object |
Source code in idendrogram/targets/matplotlib.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
idendrogram.targets.altair.to_streamlit(...)
Renders dendrogram object as a custom bi-directional Streamlit component
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dendrogram |
Dendrogram
|
idendrogram dendrogram object |
required |
orientation |
str
|
Position of dendrogram's root node. One of "top", "bottom", "left", "right". Defaults to "top". |
'top'
|
show_nodes |
bool
|
Whether to draw nodes. Defaults to True. |
True
|
height |
float
|
Height of the dendrogram. Defaults to 400. |
400
|
width |
float
|
Width of the dendrogram. Defaults to 400. |
400
|
scale |
str
|
Scale used for the value axis. One of "linear", "symlog", "log". Defaults to 'linear'. |
'linear'
|
Returns:
Type | Description |
---|---|
Optional[ClusterNode]
|
Optional[ClusterNode]: A ClusterNode object that was clicked on (None if no clicks took place) |
Source code in idendrogram/targets/streamlit.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|