Cluster¶
- detroit.cluster() Cluster¶
Builds a new cluster layout with default settings.
- Returns:
Cluster object
- Return type:
- class detroit.hierarchy.cluster.Cluster¶
Cluster layout
- __call__(root: Node) Node¶
Lays out the specified root hierarchy, assigning the following properties on root and its descendants:
node.x- the x-coordinate of the nodenode.y- the y coordinate of the node
The coordinates
xandyrepresent an arbitrary coordinate system; for example, you can treatxas an angle andyas a radius to produce a radial layout. You may want to callroot.sortbefore passing the hierarchy to the cluster layout.
- set_separation(separation: Callable[[Node, Node], int]) Cluster¶
Sets the
separationaccessor to the specified function and returns this cluster layout.
- set_size(size: tuple[float, float]) Cluster¶
Sets this cluster layout’s size to the specified two-element array of numbers
[width, height]and returns this cluster layout. A layout size ofNoneindicates that a node size will be used instead. The coordinatesxandyrepresent an arbitrary coordinate system; for example, to produce a radial layout, a size of[360, radius]corresponds to a breadth of 360° and a depth of radius.- Parameters:
size (tuple[float, float]) – Size values
- Returns:
Itself
- Return type:
- set_node_size(size: tuple[float, float]) Cluster¶
Sets this cluster layout’s node size to the specified two-element array of numbers
[width, height]and returns this cluster layout. A node size of null indicates that a layout size will be used instead. When asizeis specified, the root node is always positioned at \((0, 0)\).- Parameters:
size (tuple[float, float]) – Size values
- Returns:
Itself
- Return type: