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

Parallel Categories — Categorical Flow Diagram

Signature

sp.parcats(title, axes, category_series, *, variant="basic", **kwargs) -> Chart

Aliases: sp.parcats, sp.parallel_categories, sp.parcats_chart, sp.parallel_categories_chart, sp.build_parcats

Description

sp.parcats() is the categorical counterpart to parallel(): instead of numeric axes with one polyline per row, each axis holds a set of discrete category values, and ribbons flow between adjacent axes with width proportional to how many rows share that pair of categories — the standard chart for tracing how categorical attributes co-occur across a dataset (e.g. gender → survival → class). Internally it builds a node for every distinct (axis, category) pair and an edge for every consecutive-axis transition, then reuses the exact same layered layout engine and bezier ribbon renderer as sankey() (sankey::common::compute_layout / sankey_link_path) — the two charts share their positioning math, not just their visual family.

Data shapecategory_series is a list of rows, each row a list of category values with one entry per axis (category_series[row][axis]), mirroring exactly the row-major shape already used by parallel(series=...).

Variants

Data

axes (list[str]) — Axis names, left to right. category_series (list[list[str]]) — One row per observation, one category value per axis.

Parameters

Themes

Returns

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

Flat semi-transparent ribbons colored by their source node.

Variant "basic"Aliases basic / default / classic / flat
Preview

Dims every ribbon except each node's single heaviest outgoing flow, which is boosted to full opacity with a thin white outline — traces the dominant path through the categories.

Variant "highlight"Aliases highlight / dominant / spotlight / focus_flow
Preview