Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Sankey Diagram

Signature

sp.sankey(title, labels, edges_i, edges_j, edges_w, *, variant="basic", **kwargs) -> Chart

Aliases: sp.sankey, sp.sankeys, sp.sankey_chart, sp.sankey_diagram, sp.flow_chart

Description

Sankey diagrams visualize flows between nodes. Node widths and link widths are proportional to flow volumes. Edges are defined by source indices (edges_i), target indices (edges_j), and weights (edges_w). Nodes are laid out in columns by BFS depth.

Variants

Data

labels (list[str]) — Node names. edges_i (list[int]) — Source node indices. edges_j (list[int]) — Target node indices. edges_w (list[float]) — Flow weights. width / height (int) — Chart dimensions.

Parameters

Themes

Returns

Chart — object with .html property and .show() method.

Standard bezier ribbon links

Variant "basic"Aliases basic / default / classicReturns Chart
Preview

Increased node spacing

Variant "gapped"Aliases gapped / spaced / separatedReturns Chart
Preview

Wider nodes and ribbons

Variant "ribbon"Aliases ribbon / wide / thickReturns Chart
Preview

Thin outline style

Variant "minimal"Aliases minimal / thin / outlineReturns Chart
Preview

Reorders nodes within each depth column by descending total throughput, so the dominant flows cluster together instead of sitting in input order — makes it easy to spot which nodes carry the most volume.

Variant "sorted"Aliases sorted / reordered / by_flow / ranked
Preview