pytools.viz.dendrogram.base.DendrogramStyle#
- class pytools.viz.dendrogram.base.DendrogramStyle[source]#
Base class for dendrogram drawing styles.
- Bases
- Metaclasses
Method summary
Render the labels for all leaves.
Draw a connector between two sub-trees and their parent node.
Draw a "leg" connecting two levels of the linkage tree hierarchy.
Finalize the dendrogram, adding labels to the axes.
Get the name of the default style associated with this style class.
Get a mapping of names to default instances of this style class.
Prepare a new dendrogram for drawing, using the given title.
Definitions
- abstract draw_link_connector(*, bottom, top, first_leaf, n_leaves_left, n_leaves_right, weight, weight_cumulative, tree_height)[source]#
Draw a connector between two sub-trees and their parent node.
- Parameters
bottom (
float
) – the height (i.e. cluster distance) of the sub-treestop (
float
) – the height of the parent nodefirst_leaf (
int
) – the index of the first leaf in the left sub-treen_leaves_left (
int
) – the number of leaves in the left sub-treen_leaves_right (
int
) – the number of leaves in the right sub-treeweight (
float
) – the weight of the parent nodeweight_cumulative (
float
) – the cumulative weight of all nodes with a lower position index than the current onetree_height (
float
) – the total height of the linkage tree
- Return type
- abstract draw_link_leg(*, bottom, top, leaf, weight, weight_cumulative, tree_height)[source]#
Draw a “leg” connecting two levels of the linkage tree hierarchy.
- Parameters
bottom (
float
) – the height of the child node in the linkage treetop (
float
) – the height of the parent node in the linkage treeleaf (
float
) – the index of the leaf where the link leg should be drawn (may be afloat
, indicating a position in between two leaves)weight (
float
) – the weight of the child nodeweight_cumulative (
float
) – the cumulative weight of all nodes with a lower position index than the current onetree_height (
float
) – the total height of the linkage tree
- Return type
- finalize_drawing(*, leaf_label=None, distance_label=None, weight_label=None, max_distance=None, leaf_names=None, **kwargs)[source]#
Finalize the dendrogram, adding labels to the axes.
- Parameters
distance_label (
Optional
[str
]) – the label for the distance axisweight_label (
Optional
[str
]) – the label for the weight scalemax_distance (
Optional
[float
]) – the height (= maximum possible distance) of the dendrogramleaf_names (
Optional
[Sequence
[str
]]) – the names of the dendrogram leaf nodeskwargs (
Any
) – additional drawer-specific arguments
- Return type
- abstract classmethod get_default_style_name()#
Get the name of the default style associated with this style class.
The default style is obtained by instantiating this style class without parameters.
Common examples for default style names are matplot and text.
- Return type
- Returns
the name of the default style
- classmethod get_named_styles()#
Get a mapping of names to default instances of this style class.
- Return type
- Returns
a dictionary mapping of names to default instances of this style class
- start_drawing(*, title, leaf_label=None, distance_label=None, weight_label=None, max_distance=None, leaf_names=None, **kwargs)[source]#
Prepare a new dendrogram for drawing, using the given title.
- Parameters
title (
str
) – the title of the chartdistance_label (
Optional
[str
]) – the label for the distance axisweight_label (
Optional
[str
]) – the label for the weight scalemax_distance (
Optional
[float
]) – the height (= maximum possible distance) of the dendrogramleaf_names (
Optional
[Sequence
[str
]]) – the names of the dendrogram leaf nodeskwargs (
Any
) – additional drawer-specific arguments
- Return type