Skip to main content
A pie chart is a single stacked-fill bar bent around a circle: geom.bar({ position: 'fill' }) under coord.polar({ theta: 'y' }). Each slice’s angle is proportional to its value. Add an innerRadius and it becomes a donut — a pie with the centre cut out. Both work best for a small number of parts of a whole.

Pie

Map the slice category to color, the value to y, and leave x empty so all slices share one band:

Donut

A donut is the same recipe with an innerRadius on the polar coord. The hole leaves room for a headline number, and the thinner ring can read more cleanly than a full pie:
innerRadius is a fraction of the outer radius — 0.55 cuts the hole just past the halfway point. Larger values give a thinner ring.

Slice labels

Turn on data labels to print each slice’s value or share. On polar bars, showCategoryLabels prefixes the category:

Separated wedges

A border in the chart’s background color leaves a crisp gap between wedges: