Data Containers
idendrogram.Dendrogram
dataclass
Dataclass representing the idendrogram dendrogram object.
Source code in idendrogram/containers.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 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 161 162 163 164 165 166 167 168 169 |
|
axis_labels: List[AxisLabel]
instance-attribute
axis_labels: list of AxisLabel objects
computed_nodes: bool = True
class-attribute
instance-attribute
computed_nodes: boolean indicating if Cluster Nodes were computed at creation time
links: List[ClusterLink]
instance-attribute
links: list of ClusterLink objects
nodes: List[ClusterNode]
instance-attribute
nodes: list of ClusterNode objects
x_domain: Tuple[float, float] = (0, 0)
class-attribute
instance-attribute
x_domain: the value domain of the label axis
y_domain: Tuple[float, float] = (0, 0)
class-attribute
instance-attribute
y_domain: the value domain of the value axis
plot(backend='altair', orientation='top', show_nodes=True, height=400, width=400, scale='linear')
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 |
|
to_json()
Converts dendrogram to JSON representation.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON-formatted dendrogram |
Source code in idendrogram/containers.py
162 163 164 165 166 167 168 169 |
|
idendrogram.AxisLabel
dataclass
Dataclass storing information on axis labels.
Source code in idendrogram/containers.py
84 85 86 87 88 89 90 91 92 93 |
|
label: str
instance-attribute
label text
labelAngle: float = 0
class-attribute
instance-attribute
rotation of the text label (in degrees)
x: float
instance-attribute
x-coordinate of the label
idendrogram.ClusterLink
dataclass
Dataclass storing information about links.
Source code in idendrogram/containers.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
children_id: Union[Tuple[int, int], None] = None
class-attribute
instance-attribute
children_id: a tuple of 2 linkage IDs representing the 2 immediate clusters that got merged into this cluster
cluster_id: Union[int, None] = None
class-attribute
instance-attribute
cluster_id: flat cluster assignment ID if this link represents a flat cluster; otherwise empty
fillcolor: str
instance-attribute
fillcolor: line color used for the link
id: Union[int, None] = None
class-attribute
instance-attribute
id: the linkage ID represented by the link
strokedash: List = field(default_factory=lambda : [1, 0])
class-attribute
instance-attribute
strokedash: the dash pattern used for the link
strokeopacity: float = 1.0
class-attribute
instance-attribute
strokeopacity: the opacity level used for the link
strokewidth: float = 1.0
class-attribute
instance-attribute
strokewidth: the line width of the link
x: List[float]
instance-attribute
x: 4 coordinates of the link on the x-axis
y: List[float]
instance-attribute
y: 4 coordinates of the link on the y-axis
idendrogram.ClusterNode
dataclass
Data class storing node-level information.
Source code in idendrogram/containers.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
cluster_id: Union[int, None]
instance-attribute
flat cluster assignment ID if this link represents a flat cluster; otherwise empty
edgecolor: str
instance-attribute
color used for the edge of the node
fillcolor: str = '#fff'
class-attribute
instance-attribute
colors used to fill the node
hovertext: Dict[str, str] = field(default_factory=dict)
class-attribute
instance-attribute
Information displayed on a tooltip, in dictionary form (key: values)
id: int
instance-attribute
Linkage ID the node represents
label: str = ''
class-attribute
instance-attribute
text label displayed on the node
labelcolor: str = '#fff'
class-attribute
instance-attribute
color of the text label displayed
labelsize: float = 10.0
class-attribute
instance-attribute
size of the text label displayed
opacity: float = 1.0
class-attribute
instance-attribute
opacity level of the node
radius: float = 7.0
class-attribute
instance-attribute
radius of the node
type: str
instance-attribute
Type of the node. One of leaf
, subcluster
, cluster
, supercluster
x: float
instance-attribute
X-coordinate of the node
y: float
instance-attribute
Y-coordinate of the node