Circle Packing
Signature
sp.circle_pack(title, labels, parents, values, *, variant="basic", **kwargs) -> Chart
Aliases: sp.circle_pack, sp.circle_packing, sp.pack, sp.bubble_pack
Description
Circle packing represents hierarchical data as nested circles, where the area of each circle is proportional to its value. Parent–child relationships are defined by the parents list (empty string = root node).
Variants
Data
labels (list[str]) — Node names. parents (list[str]) — Parent name for each node ("" = root). values (list[float]) — Size of each leaf node. width / height (int) — Chart dimensions.
Parameters
Themes
Returns
Chart — object with .html property and .show() method.
Filled nested circles with depth-based opacity
Single-level bubble layout (no nesting)
Stroke-only circles
Runs a real greedy circle-packing layout: each circle is placed tangent to the best pair of already-placed circles (falling back to a spiral search when no tangent placement fits), producing a genuinely nested, non-overlapping bubble cluster instead of the grid-like flat layout.
Fills only the leaf circles with color and shrinks every container circle to a faint dashed outline — declutters the hierarchy chrome so attention goes straight to the actual data points instead of the grouping structure.