Plotly Dendrograms¤
The PlotlyDendrogram Class¤
PlotlyDendrogram
pydantic-model
¤
Bases: BaseModel
PlotlyDendrogram.
Typical usage:
from lexos.cluster import PlotlyDendrogram
dendrogram = PlotlyDendrogram(dtm)
dendrogram.show()
Needs some work in returning the figure as a figure
and html and html div.
Config:
arbitrary_types_allowed:True
Fields:
-
dtm(Optional[ArrayLike | DTM | DataFrame]) -
labels(Optional[list[str]]) -
metric(Optional[str]) -
method(Optional[str]) -
truncate_mode(Optional[str]) -
get_leaves(Optional[bool]) -
orientation(Optional[str]) -
title(Optional[str]) -
figsize(Optional[tuple]) -
colorscale(Optional[list]) -
hovertext(Optional[list]) -
color_threshold(Optional[float]) -
config(Optional[dict]) -
x_tickangle(Optional[int]) -
y_tickangle(Optional[int]) -
fig(Optional[Figure]) -
layout(Optional[dict])
Source code in lexos/cluster/plotly_dendrogram.py
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
color_threshold: Optional[float] = None
pydantic-field
¤
The color threshold for the dendrogram.
colorscale: Optional[list] = None
pydantic-field
¤
The colorscale for the dendrogram.
config: Optional[dict] = dict(displaylogo=False, modeBarButtonsToRemove=['toggleSpikelines'], scrollZoom=True)
pydantic-field
¤
The config for the dendrogram.
figsize: Optional[tuple] = (10, 10)
pydantic-field
¤
The figsize for the dendrogram.
get_leaves: Optional[bool] = True
pydantic-field
¤
The get leaves for the dendrogram.
hovertext: Optional[list] = None
pydantic-field
¤
The hovertext for the dendrogram.
labels: Optional[list[str]] = None
pydantic-field
¤
The labels for the dendrogram.
layout: Optional[dict] = {}
pydantic-field
¤
The layout for the dendrogram. Keywords and values to be passed to plotly.graph_objects.Figure.update_layout().
method: Optional[str] = 'average'
pydantic-field
¤
The method to use for the dendrogram.
metric: Optional[str] = 'euclidean'
pydantic-field
¤
The metric to use for the dendrogram.
orientation: Optional[str] = 'bottom'
pydantic-field
¤
The orientation for the dendrogram.
title: Optional[str] = None
pydantic-field
¤
The title for the dendrogram.
truncate_mode: Optional[str] = None
pydantic-field
¤
The truncate mode for the dendrogram.
x_tickangle: Optional[int] = 0
pydantic-field
¤
The x tickangle for the dendrogram.
y_tickangle: Optional[int] = 0
pydantic-field
¤
The y tickangle for the dendrogram.
__init__(**data)
¤
Initialize the PlotlyDendrogram instance.
Source code in lexos/cluster/plotly_dendrogram.py
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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
show() -> None
¤
to_html(**kwargs)
¤
Create an HTML representation of the figure.
Wrapper from the Plotly Figure to_html method. See https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html.
Source code in lexos/cluster/plotly_dendrogram.py
to_image(**kwargs)
¤
Create a static image of the figure.
Wrapper from the Plotly Figure to_image method. See https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html.
Source code in lexos/cluster/plotly_dendrogram.py
write_html(path: Path | str, **kwargs)
¤
Save an HTML representation of the figure to disk.
Wrapper from the Plotly Figure write_html method. See https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html.
Source code in lexos/cluster/plotly_dendrogram.py
write_image(path: Path | str, **kwargs)
¤
Save a static image of the figure to disk.
Wrapper from the Plotly Figure write_image method. See https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html.
Source code in lexos/cluster/plotly_dendrogram.py
rendering:
show_root_heading: true
heading_level: 3
__init__(**data)
¤
Initialize the PlotlyDendrogram instance.
Source code in lexos/cluster/plotly_dendrogram.py
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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
rendering:
show_root_heading: true
heading_level: 3
_get_valid_matrix()
¤
Get a valid matrix based on the data type of the dtm.
Source code in lexos/cluster/plotly_dendrogram.py
rendering:
show_root_heading: true
heading_level: 3
show() -> None
¤
rendering:
show_root_heading: true
heading_level: 3
to_html(**kwargs)
¤
Create an HTML representation of the figure.
Wrapper from the Plotly Figure to_html method. See https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html.
Source code in lexos/cluster/plotly_dendrogram.py
rendering:
show_root_heading: true
heading_level: 3
to_image(**kwargs)
¤
Create a static image of the figure.
Wrapper from the Plotly Figure to_image method. See https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html.
Source code in lexos/cluster/plotly_dendrogram.py
rendering:
show_root_heading: true
heading_level: 3
write_html(path: Path | str, **kwargs)
¤
Save an HTML representation of the figure to disk.
Wrapper from the Plotly Figure write_html method. See https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html.
Source code in lexos/cluster/plotly_dendrogram.py
rendering:
show_root_heading: true
heading_level: 3
write_image(path: Path | str, **kwargs)
¤
Save a static image of the figure to disk.
Wrapper from the Plotly Figure write_image method. See https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html.
Source code in lexos/cluster/plotly_dendrogram.py
rendering:
show_root_heading: true
heading_level: 3