CircularDendrogram¶
-
class
visualife.diagrams.CircularDendrogram(id, viewport, max_screen_x, max_screen_y, **kwargs)¶ Bases:
visualife.diagrams.DendrogramLayoutDraws a binary tree using a circular dendrogram layout
Circular dendrogram layout is suitable for drawing clustering results, phylogenetic trees etc.
Parameters: id – ( string) a string that is used to identify graphical elements of this tree.ID of a node will be created as
ID-idxwhereIDis the ID of this layout object andidxis the index of a node :param viewport: (SvgViewport) its derivative :param max_screen_x: (int) - right screen coordinate :param max_screen_y: (int) - bottom screen coordinate :param kwargs: see belowKeyword Arguments (**kwargs) (**kwargs):- width (
number) – width of each node in pixels - height (
number) – height of each node in pixels - separation (
number) – minimum separation between nodes in pixels - r_max (
number) – maximum radius of the diagram excluding annotations such as labels
Attributes Summary
arcangle (from 0 to 360deg) the diagram takes. cxX coordinate of the diagram’s center in the viewport units The property is computed by the draw()method :return: X viewport coordinatecyY coordinate of the diagram’s center in the viewport units The property is computed by the draw()method :return: Y viewport coordinater_maxradius of the circular dendrogram, i.e. Methods Summary
cartesian_position(node)Provides Cartesian coordinates for a given node. draw(root_node, **kwargs)Draws a binary tree given by its root node :param root_node: ( BTreeNode) - root of the tree :param kwargs: see arguments parsed TreeLayout.set_style(); this method defines also two additional keywords described belowdraw_axis()polar_position(node)Provides polar coordinates for a given node. Attributes Documentation
-
arc¶ angle (from 0 to 360deg) the diagram takes. The property is defined by kwargs sent to the
draw()method :return: angle of the diagram (in degrees)
-
cx¶ X coordinate of the diagram’s center in the viewport units The property is computed by the
draw()method :return: X viewport coordinate
-
cy¶ Y coordinate of the diagram’s center in the viewport units The property is computed by the
draw()method :return: Y viewport coordinate
-
r_max¶ radius of the circular dendrogram, i.e. the maximum distance of its leaves from its center :return: radius of the circular dendrogram
Methods Documentation
-
cartesian_position(node)¶ Provides Cartesian coordinates for a given node.
This method is used to place diagram’s nodes; is takes arc and rotation parameters into account :param node: (
TreeNode) - diagram’s node :return: (tuple(float, float)) - X and Y values in viewport coordinates
-
draw(root_node: visualife.diagrams.TreeNode.TreeNode, **kwargs)¶ Draws a binary tree given by its root node :param root_node: (
BTreeNode) - root of the tree :param kwargs: see arguments parsed TreeLayout.set_style();this method defines also two additional keywords described belowKeyword Arguments: - rotation (
float) – - rotate the whole plot by an angle given in degrees
- rotation (
- arc (
float) – - the angle of the plot; 360 makes the full circle
- arc (
-
draw_axis()¶
-
polar_position(node)¶ Provides polar coordinates for a given node.
This method is used to place diagram’s nodes; is takes arc and rotation parameters into account :param node: (
TreeNode) - diagram’s node :return: (tuple(float, float)) - radius and angle values
- width (