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

Pie Charts

Signature

sp.pie(title, labels=None, values=None, *, variant="basic", series=None, **kwargs) -> Chart

Description

sp.pie() is the unified entry point for the entire pie-chart family. The variant keyword selects the rendering strategy — all other arguments remain consistent across variants.

Variants

Parameters

Floating labels

Pass labeled=True to any variant built on the shared angle-sweep engine (basic, donut, exploded, kpi, pattern, semi) to replace the in-wedge percentage text with an outside callout: a thin connector line from the wedge edge to a label showing the percentage and the category name, colored to match its slice. This is the same style used by the reference "total breakdown" donut screenshots — it is not a separate variant, it is a display option any of those variants can turn on.

import seraplot as sp

c = sp.pie(
    labels=["Acquisition", "Conversion", "Retention", "Referral", "Other"],
    values=[42, 26, 16, 11, 5],
    variant="donut",
    center_text="27.3K",
    center_subtext="TOTAL",
    labeled=True,
)

Returns

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


Variant "basic" / "pie"Required labels, valuesReturns Chart
Preview
Variant "donut" / "ring" / "hole"Required labels, valuesReturns Chart
Preview
Variant "exploded" / "pulled" / "explode"Required labels, valuesReturns Chart
Preview
Variant "subplots" / "grid" / "facet" / "multi"Required labels, seriesReturns Chart
Preview
Variant "proportional" / "scaled" / "scalegroup"Required labels, seriesReturns Chart
Preview
Variant "semi" / "half_pie"Required labels, valuesReturns Chart
Preview
Variant "kpi" / "indicator"Required labels, valuesReturns Chart
Preview
Variant "nested" / "concentric"Required labels, values, secondary_valuesReturns Chart
Preview
Variant "pattern" / "hatched"Patterns "stripes", "dots", "diagonal", "cross"Returns Chart
Preview
Variant "waffle" / "square" / "pie_square"Required labels, valuesReturns Chart

The "square pie" — a 10x10 grid of 100 cells filled proportionally to each category's share (largest-remainder allocation, so the cell count always sums to exactly 100), with a color-matched legend. Easier to read precise percentages from than wedge angles.

Preview