vuecore.dendrogram module#
- class vuecore.dendrogram.Dendrogram(Z_dendrogram, orientation='bottom', hang=1, hide_labels=False, labels=None, colorscale=None, hovertext=None, color_threshold=None, width=inf, height=inf, xaxis='xaxis', yaxis='yaxis')[source]#
Bases:
object
Refer to plot_dendrogram() for docstring.
- get_color_dict(colorscale)[source]#
Returns colorscale used for dendrogram tree clusters.
- Parameters:
colorscale (list) – colors to use for the plot in rgb format
- Return (dict):
default colors mapped to the user colorscale
- get_dendrogram_traces(Z_dendrogram, hang, colorscale, hovertext, color_threshold)[source]#
Calculates all the elements needed for plotting a dendrogram.
- Parameters:
- Return (tuple):
Contains all the traces in the following order:
trace_list: List of Plotly trace objects for dendrogram tree
icoord: All X points of the dendrogram tree as array of arrays with length 4
dcoord: All Y points of the dendrogram tree as array of arrays with length 4
ordered_labels: leaf labels in the order they are going to appear on the plot
Z_dendrogram[‘leaves’]: left-to-right traversal of the leaves
- vuecore.dendrogram.plot_dendrogram(Z_dendrogram, cutoff_line=True, value=15, orientation='bottom', hang=30, hide_labels=False, labels=None, colorscale=None, hovertext=None, color_threshold=None)[source]#
Modified version of Plotly _dendrogram.py that returns a dendrogram Plotly figure object with cutoff line.
- Parameters:
Z_dendrogram (ndarray) – Matrix of observations as array of arrays
cutoff_line (boolean) – plot distance cutoff line
orientation (str) – ‘top’, ‘right’, ‘bottom’, or ‘left’
hang (float) – dendrogram distance of leaf lines
hide_labels (boolean) – show leaf labels
labels (list) – List of axis category labels(observation labels)
colorscale (list) – Optional colorscale for dendrogram tree
hovertext (list[list]) – List of hovertext for constituent traces of dendrogram clusters
color_threshold (double) – Value at which the separation of clusters will be made
- Returns:
Plotly figure object
Example:
figure = plot_dendrogram(dendro_tree, hang=0.9, cutoff_line=False)