Partition

detroit.partition() Partition

Builds a new partition layout with the default settings.

Returns:

Partition object

Return type:

Partition

class detroit.hierarchy.partition.Partition

Partition layout

__call__(root: Node) Node

Lays out the specified root hierarchy, assigning the following properties on root and its descendants:

  • node.x0 - the left edge of the rectangle

  • node.y0 - the top edge of the rectangle

  • node.x1 - the right edge of the rectangle

  • node.y1 - the bottom edge of the rectangle

You must call root.sum before passing the hierarchy to the partition layout. You probably also want to call root.sort to order the hierarchy before computing the layout.

Parameters:

root (Node) – Root node

Returns:

Node organized as partition

Return type:

Node

set_round(round: bool) Partition

Enables or disables rounding according to the given boolean and returns this partition layout.

Parameters:

round (bool) – Round boolean value

Returns:

Itself

Return type:

Partition

set_size(size: tuple[float, float]) Partition

Sets this partition layout’s size to the specified two-element array of numbers [width, height] and returns this partition layout.

Parameters:

size (tuple[float, float]) – Size values

Returns:

Itself

Return type:

Partition

set_padding(padding: float) Partition

Sets the padding to the specified number and returns this partition layout.

Parameters:

padding (float) – Padding value

Returns:

Itself

Return type:

Partition