pytools.viz.dendrogram.DendrogramDrawer#
- class pytools.viz.dendrogram.DendrogramDrawer(style=None)[source]#
Draws dendrogram representations of
LinkageTree
objects.- Bases
- Metaclasses
- Parameters
style (
Union
[DendrogramStyle
,str
,None
]) – the style to be used for drawing; either as aDrawingStyle
instance, or as the name of a named style supported by this drawer type; if not specified, the default style will be used as returned byget_default_style()
Method summary
Render the data using the style associated with this drawer.
Get the default style for this drawer.
Get a mapping of names to style factories for all named styles recognized by this drawer's initializer.
Get a style object by name.
Get all style classes available for this drawer type.
Using the given data object, derive keyword arguments to be passed to the style's
start_drawing()
andfinalize_drawing()
methods.Attribute summary
style
The
DrawingStyle
used by this drawer.Definitions
- _draw(data)[source]#
Core drawing method invoked my method
draw()
.Must be implemented by subclasses of
Drawer
.- Parameters
data (
LinkageTree
) – the data to be rendered- Return type
- draw(data, *, title)#
Render the data using the style associated with this drawer.
Creates a thread-safe lock on this drawer, then calls the following methods in sequence:
Method
start_drawing()
of this drawer’sstyle
attribute, passing the title and additional keyword arguments obtained from this drawer’sget_style_kwargs()
Method
_draw()
, passing along thedata
argumentMethod
finalize_drawing()
of this drawer’sstyle
attribute, passing the keyword arguments obtained from this drawer’sget_style_kwargs()
- Parameters
data (
DendrogramDrawer
) – the data to be renderedtitle (
str
) – the title of the resulting chart
- Return type
- classmethod get_default_style()[source]#
Get the default style for this drawer.
- Return type
- Returns
the default style for this drawer
- classmethod get_named_styles()#
Get a mapping of names to style factories for all named styles recognized by this drawer’s initializer.
A factory is a class or function with no mandatory parameters.
- Return type
- classmethod get_style(name)#
Get a style object by name.
- classmethod get_style_classes()[source]#
Get all style classes available for this drawer type.
- Return type
- Returns
an iterable of style classes
- get_style_kwargs(data)[source]#
Using the given data object, derive keyword arguments to be passed to the style’s
start_drawing()
andfinalize_drawing()
methods.- Parameters
data (
LinkageTree
) – the data to be rendered- Return type
- Returns
the style attributes for the given data object