Part-to-wholeBeginner

Pie Chart

A circular chart divided into slices to show how parts make up a whole. Instantly recognizable, widely used, and surprisingly controversial among data visualization experts.

// 01The chart

What it looks like

Example — Website traffic by sourceQ1 2025
42%Organic search28%Direct18%Social media12%Referral

A pie chart showing website traffic sources. With just four slices sorted clockwise from 12 o’clock, proportions are easy to compare at a glance.

// 02Definition

What is a pie chart?

A pie chart is a circular chart divided into wedge-shaped slices, where each slice represents a category’s proportion of the whole. The angle of each slice (and therefore its area) is proportional to the quantity it represents — a slice covering a quarter of the circle stands for 25% of the total. The chart is read like a clock face: the eye starts at 12 o’clock, follows the slices clockwise, and registers the dominant share before moving on to the smaller wedges.

Pie charts answer one fundamental question: “How does each part contribute to the whole?” They are the visual translation of “a slice of the pie” — a metaphor that nearly every reader, technical or not, understands instantly. That immediate legibility is the chart’s biggest strength: a 60/40 split, a clearly dominant majority, or a single “one-third” share all communicate in less than a second from a pie. No other chart type sells the part-to-whole story as fast.

However, pie charts are controversial in data visualization. Cleveland and McGill’s 1984 perception study showed that humans judge length and position much more accurately than angle or area, so a sorted bar chart almost always reads more precisely than a pie. Two slices of 28% and 32% look almost identical in a pie but are clearly different in a bar chart. The reasonable consensus, then, is to limit pie charts to two-to-five slices with clearly different proportions, and to switch to a bar, treemap, or 100% stacked bar whenever precision or comparison matters more than the part-to-whole metaphor.

Origin: William Playfair created the first known pie chart in 1801, in his Statistical Breviary, to show the proportions of the Turkish Empire located in Asia, Europe, and Africa. Playfair had already invented the bar chart and line chart in his 1786 Commercial and Political Atlas; the pie completed his trio of foundational chart types. Florence Nightingale popularized a related variant — the polar area diagram — in 1858 to argue for sanitary reform after the Crimean War.

// 03When to use

When a pie chart is the right tool

Pie charts are narrow but powerful. Reach for one only when the part-to-whole story is the headline, the slice count is small, and your audience expects a familiar metaphor.

✓Use a pie chart when…
  • You have 2–5 categories that add up to a meaningful whole (100%)
  • One category clearly dominates and you want to emphasize its share
  • Your audience is non-technical and expects the “slice of a pie” metaphor
  • You’re showing a simple split: majority vs minority, yes vs no, win vs loss
  • The visual needs to convey “part of a whole” at a glance in a dashboard tile
  • The categories have clearly different proportions (not 22%, 24%, 26%, 28%)

// 04When not to use

When to reach for something else

The same properties that make pies intuitive make them fragile. Avoid them whenever precision, comparison across wholes, or many categories matter more than the part-to-whole metaphor.

×Avoid a pie chart when…
  • You have more than 5–6 categories — too many slices become unreadable
  • Categories have similar proportions — the eye can’t reliably compare 23% vs 27%
  • You need to compare values precisely — sorted bar charts are far more accurate
  • Values don’t add up to a meaningful total (multi-select survey responses, for example)
  • You want to show change over time — multiple pies side by side are nearly impossible to compare
  • You need to compare two or more wholes — a 100% stacked bar handles this far better
  • You need to show hierarchy or sub-categories — use a treemap or sunburst instead
  • The chart has to fit in a tile smaller than ~150 px on its longest side — small pies lose all label legibility

// 05Data requirements

What your data needs to look like

Before building the chart, your dataset needs to fit a specific shape. Use this checklist to confirm yours does.

Shape

One row per category. Two columns are required: a non-overlapping category label and a non-negative numeric value. The values should sum to a meaningful whole (often, but not always, 100%).

Minimum rows

2

Maximum rows

6

Required fields
categoryrequired
string / categorical

A label for each slice. Categories must be discrete, non-overlapping, and collectively exhaustive — they should cover every member of the whole exactly once. Limit to 2–5 named categories plus an optional “Other”.

valuerequired
number (continuous, non-negative)

The quantity each slice encodes. Values must share a single unit and should sum to a meaningful total (often 100%, but a raw count works too). Negative values are not allowed in a pie chart — use a diverging bar chart instead.

highlight
boolean (optional)

Optional flag to draw attention to one slice with the accent color or a small offset. Useful for callouts but never required.

order
number (optional)

Optional explicit slice order. By default, sort slices descending by value with the largest starting at 12 o’clock and “Other” last. Override only when category order is itself meaningful (Likert responses, age brackets).

Example data
categoryvalueshare
Organic42,00042%
Direct28,00028%
Social18,00018%
Referral12,00012%

Group categories that fall below ~3–5% of the total into a single “Other” row so the named slices stay between two and five. Pre-compute share = value / sum(value) * 100 if your tool doesn’t do it for you.

// 06Anatomy

Parts of a pie chart

Annotated diagram of the slice, the slice boundary, the center anchor, the slice angle, and the legend. These five parts cover everything a reader uses to interpret a pie chart.

ABCD40%27%20%13%E
A — Slice: Each wedge represents one category’s share of the whole
B — Slice boundary: The lines separating slices, often white for visual clarity
C — Center point: All slices radiate from the center — the chart reads as a single circle
D — Slice angle: Proportional to the value — a 25% slice spans 90° of the 360° circle
E — Legend: Maps colors to category names and values, often replaced by direct slice labels

// 07Step-by-step

Step-by-step: how to build a good pie chart

A nine-step recipe that works regardless of the tool. Walk through it the first few times and the moves become automatic; skip steps and the chart usually shows it.

  1. 1

    Confirm the data really is part-to-whole

    Check that your categories are mutually exclusive and cover the entire whole. If a respondent could pick more than one option, or if the slices don’t add up to a meaningful 100%, a pie chart will mislead. Switch to a bar chart and stop now.
  2. 2

    Limit the chart to 2–5 slices

    Aggregate the smallest categories into a single “Other” slice so the chart never carries more than five named slices plus Other. Beyond five, the eye stops being able to compare angles, and the chart becomes a colourful blob.
  3. 3

    Sort slices descending by value

    Place the largest slice starting at 12 o’clock, then continue clockwise in descending size. Put the “Other” slice last, regardless of its actual share. This convention turns the chart into a clock-face ranking the eye can scan in one sweep.
  4. 4

    Convert raw values to percentages

    Pre-compute share = value / sum(values) * 100 so you can label slices directly with percentages. The percentage is the number readers actually want; the raw value can sit beside it in parentheses if the absolute matters too.
  5. 5

    Choose colors with intent

    Default to a single accent color for the slice your headline is about and a graded neutral for the rest, or use a small ColorBrewer qualitative palette of 3–4 hues. Avoid using a different rainbow color for every slice — it adds noise without information.
  6. 6

    Label slices directly with name and percent

    Place each label outside the slice with a thin leader line, written as “Category — 42%”. Direct labels remove the need for a separate legend and let readers compare values without the eye-jumping cost of a color lookup.
  7. 7

    Add a takeaway title

    Use the title to state the conclusion, not just the topic. “Organic search drives 42% of Q1 traffic — nearly twice direct” is a takeaway. “Traffic by source” is a label. Lead with the takeaway and put the descriptive label as a subtitle.
  8. 8

    Provide a data table fallback

    Beneath or beside the chart, render the same data as a small table of category and percentage. Many readers will copy the table rather than re-key from the visual, and the table also serves as the screen-reader and print fallback.
  9. 9

    Verify at the size readers will see it

    Pies need to be large enough to read — a 120 px dashboard tile pie is unreadable. Test at 200%, 100%, and 50% of the planned size, and confirm the smallest labelled slice is still legible at the smallest planned width.

// 08Real-world examples

Where you’ll see pie charts used

Pie charts show up wherever the part-to-whole story dominates: business dashboards, election graphics, household budgets, and product mix breakdowns. Every example below follows the same fundamentals: small slice count, sorted clockwise, and a takeaway-led title.

01

Business: Revenue mix by product line

A SaaS company’s annual report uses a pie chart to show that 58% of revenue comes from its flagship product, 24% from add-ons, 12% from professional services, and 6% from training. The single dominant slice immediately tells investors where the business actually lives, and the small remaining slices set up a discussion about diversification.

Business
02

Politics: Election vote share

A national broadcaster publishes a pie chart on election night showing vote share for the four parties that crossed the 5% threshold, with everything else in an “Other” slice. The pie is the right shape because every vote belongs to exactly one party, the categories sum to 100%, and there are five or fewer named slices.

Politics
03

Personal finance: Monthly budget

A budgeting app shows a pie chart of household spending: 35% housing, 18% food, 14% transport, 11% utilities, 22% other. The pie is more readable than a bar chart here because the user wants the at-a-glance question “where did my money go?”, not “which category was second largest?”.

Personal Finance
04

Public health: Causes of death by category

A national statistics agency publishes a pie chart of cause-of-death categories (cardiovascular, cancer, respiratory, accidents, other). With five clean slices, a clear dominant share, and an audience that needs the part-to-whole framing, the pie outperforms a bar chart for the front-page summary card. Detailed breakdowns sit in a sortable table below.

Public Health

// 09Variations

Types of pie charts

The basic pie has several popular variants. The headline rule is the same as ever: pick the variant whose strengths match your question, and skip the cosmetic ones (3D, exploded) entirely.

Donut chart

A pie with a hollow center. The center can display a total, key metric, or icon. Slightly easier to read than a full pie because the inner edge length is a useful secondary cue.

Semi-circle (half pie)

Uses only the top half of a circle. Often used in dashboards as a gauge showing progress toward a target, or as a compact way to fit a pie into a wide-format card.

Waffle chart

A 10×10 grid where each cell represents 1%. More precise than pie slices and easier to compare proportions, especially for shares smaller than ~10%.

Polar area diagram

Florence Nightingale’s 1858 variant. Each slice has the same angle but a different radius, encoding value with area. Useful for showing seasonality or repeated categories.

// 10Comparisons

Pie chart vs other chart types

Pie charts compete with several neighbors in the part-to-whole family, plus the bar chart that everyone reaches for as the precision alternative. The differences matter — picking the wrong one changes what your reader is allowed to conclude.

Pie chart vs donut chart

Functionally identical — both encode parts of a whole as arcs of a circle. The donut’s hollow center frees up real estate for a total or label, and many readers find the inner edge length a useful secondary cue. Choose donut when you have a key metric to display in the middle; pie when you don’t.

Pie chart

A solid disc divided into slices that share a center point. The classic, instantly recognized form. Best when you have nothing useful to put in the middle.

  • Universally familiar shape
  • All slice area is encoding
  • No room for a center label

Donut chart

A pie with a hollow center, often used to display the total, the largest slice’s share, or a brand mark. The arc length on the inner edge is a useful secondary cue.

  • Center can hold a total or KPI
  • Slightly easier to compare arcs
  • Common in BI dashboards

Pie chart vs bar chart (for proportions)

Bar charts are more accurate for any comparison — humans judge length better than angles or areas (Cleveland & McGill, 1984). Pies are more intuitive for the part-to-whole metaphor and for non-technical readers. Use pies when the story is “one share dominates”; bars when the story is “which category is biggest”.

Pie chart

Encodes share with slice angle and area. Reads best with 2–5 slices and a clearly dominant category. Loses precision quickly past five slices.

  • Communicates “part of a whole” at a glance
  • Best with 2–5 categories
  • Less accurate for close comparisons

Sorted bar chart

Encodes value with bar length on a shared zero baseline. Reads as a precise ranking even with 10+ categories. Loses the 100% anchor unless you label totals.

  • Highest accuracy for comparisons
  • Scales to 15–20 categories
  • Doesn’t emphasize “whole” as strongly

Pie chart vs 100% stacked bar

A 100% stacked bar is essentially a pie chart unrolled into a straight line. It keeps the part-to-whole story but stacks linearly so multiple wholes can sit side by side. Pies are the better choice for a single moment in time; stacked bars win whenever you need to compare multiple wholes or show change over time.

Pie chart

One whole, divided into slices around a center. Excellent for emphasizing a single dominant share. Hard to compare across multiple pies.

  • One snapshot, one whole
  • Iconic part-to-whole shape
  • Falls apart when comparing wholes

100% stacked bar

Each bar represents a whole; segments inside the bar represent the parts. Multiple bars sit next to each other so you can compare the same share across groups or over time.

  • Compares many wholes side by side
  • Best for change over time
  • Only the bottom segment compares cleanly

Pie chart vs treemap

Treemaps encode share with rectangle area instead of slice angle, and tile the rectangles to fill a square. They scale to dozens or hundreds of categories where a pie would collapse, and they support hierarchical data (a category with sub-categories nested inside its rectangle). Pies stay better for fewer than five flat categories.

Pie chart

Round, intuitive, and 240 years old. The metaphor (slice of a pie) is universal. Limit to 2–5 flat categories.

  • Best for 2–5 flat categories
  • Universally understood metaphor
  • Cannot show hierarchy

Treemap

Rectangles tiled to fill a square, sized by value. Can nest sub-rectangles inside parent rectangles to show hierarchy. Scales to dozens of categories.

  • Scales to many categories
  • Supports nested hierarchy
  • Less intuitive for general audiences

// 11Common mistakes

Mistakes to watch out for

Almost every broken pie chart in the wild fails the same handful of ways. If you only memorize six rules, make them these.

Too many slices

This is the most common and most damaging mistake. Once you exceed five or six slices, the chart becomes a colorful blob: tiny slivers are impossible to read, and similar-sized slices all blend together. Group small categories into a single “Other” slice, or switch to a sorted bar chart — length comparison scales much better than angle comparison.

3D perspective effects

Three-dimensional pies distort the perceived size of slices because of the foreshortening caused by the perspective tilt. Slices at the front of a 3D pie look larger than back slices of the same value. Always use flat, 2D pies. The same warning applies to drop shadows and bevel effects — they pull the eye to the chart’s decoration instead of its data.

Exploded or separated slices

Pulling slices away from the center destroys the shared anchor that makes the chart legible. Without the common center, the eye has nothing to pivot from, and slice-to-slice comparison collapses. Exploded pies look dramatic but sacrifice the chart’s primary function. If you need to emphasize one slice, use color and a direct label instead of physically separating it.

Values that don’t add up to 100%

Pie charts only make sense when slices represent parts of one complete whole. If your categories overlap (a multi-select survey), or if they don’t add up to a meaningful total, a pie chart will mislead the reader into thinking the slices fit together when they don’t. Switch to a sorted bar chart or a UpSet plot for overlapping sets.

Comparing pies side by side

Showing “Q1 vs Q2 vs Q3” as three pies forces the reader to mentally compare the same slice across three circles, which is one of the hardest perceptual tasks in data visualization. A 100% stacked bar chart or a slope chart does the same job an order of magnitude better. Reserve pies for a single moment in time.

Rainbow color palettes

Using a different fully-saturated color for every slice adds visual noise without information. Default to a single accent color for the slice your headline is about and graded neutrals for the rest, or a small ColorBrewer qualitative palette of three or four hues. Color should encode meaning (highlighting one slice) or category, not decorate the chart.

Tiny slices that no label can fit

If a slice represents less than ~3% of the total, you can’t fit a percentage label inside it, the leader line gets in the way of the next slice’s label, and the slice itself is barely a sliver. Group anything below your threshold into a single “Other” slice and detail the contents in a small data table beneath the chart.

// 12Accessibility

Accessibility checklist

Run through this list before publishing. The chart should still communicate its message to readers using assistive technology, color-blind users, keyboard navigation, and reduced-motion settings.

  • ✓

    Provide a text alternative for the chart

    WCAG 1.1.1
    Add an accessible name (alt text or aria-label) that summarizes the takeaway and the slices, not just the chart type. “Pie chart of traffic sources” is weak; “Traffic by source: organic 42%, direct 28%, social 18%, referral 12%” is strong.
  • ✓

    Do not rely on color alone

    WCAG 1.4.1
    Reinforce slice color with direct labels, distinct shapes on small markers, or pattern fills (SVG <pattern> with hatching, dots, or stripes). Roughly 1 in 12 men and 1 in 200 women have some form of color-vision deficiency.
  • &check;

    Pattern fills for color-blind readers

    WCAG 1.4.1
    When a chart must be readable in greyscale or by color-blind readers, swap solid fills for SVG patterns or fill-opacity differences. Each slice gets its own visually distinct fill so it can be identified without seeing color at all.
  • &check;

    Color contrast meets WCAG AA

    WCAG 1.4.3
    Slice fill against the background should reach at least 3:1 contrast for graphical objects. Text labels (titles, percentages, callouts) should reach 4.5:1 for body text or 3:1 for large text. White separators between slices should also meet 3:1 against both adjacent fills.
  • &check;

    Label slices directly with percentage

    WCAG 1.3.1
    Print each slice’s percentage label directly on or next to the slice with a leader line. Direct labels remove the round-trip to a separate legend that screen-magnifier users and color-blind readers can’t easily make.
  • &check;

    Expose the underlying data

    WCAG 1.3.1
    Place a small table of category and percentage next to or beneath the pie. Many readers will copy this data, and screen-reader users can navigate it row by row instead of trying to interpret the SVG.
  • &check;

    Keep tooltip content keyboard-accessible

    WCAG 2.1.1
    If the chart is interactive, every slice must be reachable with the Tab key and its tooltip must appear on focus, not only on hover. The focused slice should also have a visible focus ring (an outline outside its arc).
  • &check;

    Respect prefers-reduced-motion

    WCAG 2.3.3
    If slices animate in or rotate on load, gate the animation behind a prefers-reduced-motion: no-preference media query so motion-sensitive readers see the final state immediately.
  • &check;

    Make the chart resizable and zoomable

    WCAG 1.4.4
    Let the chart container scale with the viewport and stay legible at 200% browser zoom. Use a responsive viewBox instead of a fixed pixel size, and ensure label text reflows or hides gracefully when the slice gets too small.

// 13Best practices

Design and craft tips

The mistakes section above tells you what to avoid. The list below is the positive version: the small set of habits that separate a good pie chart from a passable one.

Do

Limit slices to 5 or fewer

Keep named slices to 2–5 and group the rest into a single “Other” slice. Beyond five, the eye loses the ability to compare angles and the chart fails the one job it has.
×Don’t

Use 3D, exploded, or perspective effects

Three-dimensional tilt distorts areas; exploded slices remove the shared center point; both make accurate comparison impossible. Always use a flat 2D pie.
Do

Sort slices clockwise from 12 o’clock

Place the largest slice starting at 12 o’clock and continue clockwise in descending order, with “Other” last. The clock-face convention is what readers expect.
×Don’t

Use a different color for every slice

Rainbow palettes add noise without information. Default to one accent color and graded neutrals, or a small qualitative palette of 3–4 hues from ColorBrewer.
Do

Label slices directly with percent

Print “Category — 42%” on or next to each slice with a leader line. Direct labels eliminate the eye-jumping cost of a separate color legend.
×Don’t

Compare two pies side by side

Comparing the same slice across two pies forces a mental re-anchoring that almost no reader does correctly. Switch to a 100% stacked bar or a slope chart for change-over-time comparisons.
Do

Lead with a takeaway title

Use the title to state the conclusion (“Organic drives 42% of Q1 traffic”) and a smaller subtitle for the descriptive label (“Website traffic by source, Q1 2025”).
×Don’t

Use a pie when proportions are similar

If your slices are 23%, 24%, 26%, and 27%, the pie will look like a uniform pinwheel. Switch to a sorted bar chart — length is far more discriminating than angle.

// 15Tool instructions

How to build it in your tool of choice

Every general-purpose tool has a pie chart. The recipes below get you to a clean, sorted, 5-slice-or-fewer pie with direct labels in each of the most common platforms.

Microsoft Excel

Spreadsheet — ~3 min
  1. 01Place category labels in column A and numeric values in column B, with a header row. Aggregate small slices into an “Other” row so the named slices stay between two and five.
  2. 02Sort the data range descending by value so the largest slice draws first; this makes Excel place it at the 12 o’clock anchor.
  3. 03Highlight both columns including the headers, then choose Insert → Charts → Pie → 2-D Pie. Skip the 3-D and exploded variants — they distort proportions.
  4. 04Right-click the chart and choose Add Data Labels → More Data Label Options → Percentage. Move the labels to Outside End so they sit just past each slice with a leader line.
  5. 05Open Format Data Series → Series Options and set Angle of First Slice to 0° so the largest slice begins at 12 o’clock.
  6. 06Replace the default chart title with a takeaway sentence (“Organic drives 42% of traffic”), and remove the legend if every slice is now labelled directly.

Tip: Excel will happily let you build a pie with twelve slices. Don’t. If you can’t group your data down to five named slices plus Other, switch to a sorted bar chart instead.

Google Sheets

Spreadsheet — ~3 min
  1. 01Lay out the data with category labels in column A and values in column B. Sort the range descending by value before charting so the largest slice draws first.
  2. 02Select the range and choose Insert → Chart. In the Chart editor, set Chart type to Pie chart (not Doughnut, unless you want a donut).
  3. 03Switch to the Customize tab → Pie chart, and set Slice label to Percentage so each slice prints its share directly.
  4. 04Open Customize → Pie chart → 3D and confirm it is set to Off. The 3D pie option is still available but distorts proportions.
  5. 05Use Customize → Pie slice to recolor individual slices: paint the largest slice with the accent color and the rest with graded neutrals.
  6. 06Edit the chart title under Chart & axis titles → Chart title and write a takeaway sentence rather than the default category-name placeholder.

Sheets does not auto-sort slices clockwise from 12 o’clock. Sort the underlying data range first, then re-insert or refresh the chart.

Python (Matplotlib)

Code — ~5 min
  1. 01Install Matplotlib with pip install matplotlib if it isn’t already in your environment.
  2. 02Build two parallel sequences — labels and values — and sort them descending by value so the largest slice draws first.
  3. 03Call plt.pie(values, labels=labels, startangle=90, counterclock=False) so the largest slice starts at 12 o’clock and slices proceed clockwise.
  4. 04Pass autopct='%1.0f%%' to print each slice’s percentage directly on the slice; combine with pctdistance=0.78 for placement just inside the slice edge.
  5. 05Set colors=['#c94a2e', '#e8c4b8', '#f5ede9', '#f0ddd8'] (or any palette of 3–5 hues). Use a single accent color for the slice your headline is about.
  6. 06Call plt.axis('equal') so the pie renders as a true circle, then plt.title() with a takeaway sentence and plt.tight_layout() before plt.savefig() or plt.show().

Use wedgeprops={'edgecolor': 'white', 'linewidth': 1.5} to add white separators between slices. The thin gaps make adjacent slice boundaries far easier to read.

R (ggplot2)

Code — ~5 min
  1. 01Install ggplot2 with install.packages('ggplot2') and load it with library(ggplot2).
  2. 02Build a data frame with two columns: a categorical column and a numeric value column. Compute a percentage column with value / sum(value) * 100.
  3. 03Reorder the categorical column with factor(category, levels = category[order(-value)]) so the largest slice plots first.
  4. 04Build a stacked bar chart with ggplot(df, aes(x = '', y = value, fill = category)) + geom_col(width = 1).
  5. 05Wrap the bar in coord_polar(theta = 'y', start = 0) to convert the stacked bar into a pie. The start = 0 keeps the largest slice anchored at 12 o’clock.
  6. 06Add geom_text(aes(label = paste0(round(pct), '%')), position = position_stack(vjust = 0.5), color = 'white') to print percentages directly on each slice, then theme_void() to drop the polar grid.

ggplot2 has no native geom_pie() because the package author dislikes pie charts. The coord_polar() trick is the canonical workaround.

JavaScript (D3.js)

Code — ~10 min
  1. 01Install D3 (npm i d3) or include the CDN script tag in your HTML.
  2. 02Create an SVG container with width and height, and translate a <g> element to the center of the SVG so all arcs draw from the middle.
  3. 03Build the slice generator with const pie = d3.pie().sort((a, b) => d3.descending(a.value, b.value)).value(d => d.value); to sort slices descending and pass through the value accessor.
  4. 04Create the arc generator with const arc = d3.arc().innerRadius(0).outerRadius(radius); use innerRadius(radius * 0.5) instead if you want a donut.
  5. 05Bind data: g.selectAll('path').data(pie(data)).join('path').attr('d', arc).attr('fill', d => color(d.data.category)).attr('stroke', '#fff').attr('stroke-width', 1.5);
  6. 06Add direct labels with d3.arc().innerRadius(radius * 1.05).outerRadius(radius * 1.05).centroid() and append <text> elements that print '${name} — ${pct}%' just outside each slice.

Skip the d3-shape transition for slices unless you genuinely need it. A pie that animates in slice by slice can violate prefers-reduced-motion and rarely adds clarity.

Tableau

BI — ~4 min
  1. 01Connect to your data source. On the Marks card, change the mark type from Automatic to Pie.
  2. 02Drag the value measure onto the Angle property in the Marks card — this controls slice size.
  3. 03Drag the category dimension onto the Color property; Tableau will assign a color per slice.
  4. 04Sort slices by clicking the category pill on Color and choosing Sort → Descending by your value measure, so the largest slice anchors at 12 o’clock.
  5. 05Drag the value measure onto the Label property as well, then right-click the label, choose Quick Table Calculation → Percent of Total, and format as percentage with no decimals.
  6. 06Resize the worksheet so the pie has room — Tableau pies render small by default. Edit the worksheet title to a takeaway sentence and remove the color legend if every slice is now labelled.

Tableau’s default pie does not enforce 5-slice limit. If you have more, build a calculated field that bins anything below a threshold (e.g. 3%) into an “Other” category before plotting.

Power BI

BI — ~4 min
  1. 01In Power BI Desktop, open the Visualizations pane and choose Pie chart (or Donut chart for a hollow center).
  2. 02Drag your category field to the Legend well and your value field to the Values well; Power BI builds the slices automatically.
  3. 03Open the Format pane → Detail labels and set Label style to Category, percent of total, and Position to Outside.
  4. 04Under Format → Slices, click the largest slice and recolor it with your accent color; leave the others in graded neutrals from the theme.
  5. 05Open Format → Title and replace the default field name with a takeaway sentence (“Organic drives 42% of Q1 traffic”).
  6. 06Use the More options menu in the top-right of the visual and choose Sort axis → your value field, descending, so the largest slice anchors at the top.

Power BI ships a Donut chart visual right next to the pie. Pick whichever fits the space — functionally they’re identical.

// 16Code examples

Working code in the most common stacks

Three runnable snippets that produce the same chart — a sorted four-slice pie with white separators, direct percentage labels, and the largest slice in the brand accent. Copy, paste, and replace the data with yours.

pie_chart.py
import matplotlib.pyplot as plt

categories = ["Organic", "Direct", "Social", "Referral"]
values     = [42, 28, 18, 12]

# Sort descending so the largest slice draws first.
pairs = sorted(zip(values, categories), reverse=True)
values_sorted = [v for v, _ in pairs]
labels_sorted = [c for _, c in pairs]

# Single accent color for the largest slice; graded neutrals for the rest.
colors = ["#c94a2e", "#e8c4b8", "#f5ede9", "#f0ddd8"]

fig, ax = plt.subplots(figsize=(6, 6))
wedges, texts, autotexts = ax.pie(
    values_sorted,
    labels=labels_sorted,
    colors=colors,
    autopct="%1.0f%%",
    startangle=90,        # largest slice begins at 12 o'clock
    counterclock=False,   # proceed clockwise
    pctdistance=0.78,
    wedgeprops={"edgecolor": "white", "linewidth": 1.5},
)

# Style the percentage labels.
for t in autotexts:
    t.set_color("white")
    t.set_fontweight("bold")

ax.axis("equal")  # render as a true circle.
ax.set_title("Website traffic by source — Q1 2025", loc="left", fontsize=14)

plt.tight_layout()
plt.savefig("pie_chart.png", dpi=200)
plt.show()
$ python pie_chart.py

// 17 — FAQs

Frequently asked questions

What is a pie chart?+

A pie chart is a circular chart divided into wedge-shaped slices, where each slice represents a category’s proportion of the whole. The angle of each slice (and therefore its area) is proportional to the quantity it represents — a slice that covers a quarter of the circle stands for 25% of the total.

When should you use a pie chart?+

Use a pie chart when you have 2–5 categories that add up to a meaningful whole (100%), one category clearly dominates and you want to emphasize its share, and your audience is non-technical and instantly understands the “slice of a pie” metaphor. Pie charts excel at communicating a single proportion at a glance.

When should you avoid a pie chart?+

Avoid a pie chart when you have more than 5–6 categories — too many slices become unreadable. Skip them when categories have similar proportions (the eye can’t reliably compare 23% vs 27%), when you need precise comparisons (use a bar chart), or when values don’t sum to a meaningful whole (e.g. multi-select survey responses).

How is a pie chart different from a donut chart?+

A donut chart is a pie chart with a hollow center. The center can hold a total, an icon, or a key metric, and many designers find donuts marginally easier to read because the eye can use the inner edge length as a secondary cue. Functionally they answer the same part-to-whole question.

How is a pie chart different from a bar chart?+

A pie chart shows how parts contribute to a whole that totals 100%; a bar chart compares values across discrete categories with no part-to-whole constraint. Bar charts are more accurate for comparison — humans judge length much better than angles or areas — but pie charts are more intuitive for “here’s the share” storytelling.

How many slices should a pie chart have?+

Two to five slices is the sweet spot. By six slices, comparison gets noticeably harder; past seven, the chart usually fails. If you have more categories, group the small ones into an “Other” slice or switch to a sorted bar chart, treemap, or 100% stacked bar.

Should pie chart slices be sorted?+

Yes. The convention is to start the largest slice at 12 o’clock and continue clockwise in descending order. Place the “Other” slice last regardless of size. This sorting turns the chart into an instant ranking and helps the reader scan it like a clock face.

Are pie charts bad?+

Pie charts are controversial, not bad. Studies dating back to Cleveland and McGill in 1984 show that humans judge length and position more accurately than angle or area, so a bar chart almost always reads more precisely. But for non-technical audiences, a 60/40 split, or a single dominant share, a pie chart still communicates the part-to-whole relationship faster than any other chart.

Should you use a 3D pie chart?+

No. The 3D perspective tilt distorts slice areas — slices at the front look bigger than back slices of the same value. Stick to flat 2D pies. The same rule applies to exploded pies, where pulling slices away from the center destroys the shared anchor that makes proportion comparison possible.

Can a pie chart show change over time?+

Not well. Side-by-side pies force the reader to mentally compare the same slice across multiple circles, which is extremely hard. For change over time, use a 100% stacked bar chart, a stacked area chart, or a slope chart — all three keep proportion comparison along a single axis.

What category of chart is a pie chart?+

Pie Chart belongs to the Part-to-whole family of charts — alongside donut charts, treemaps, waffle charts, stacked bar charts, and Marimekko charts. All of them answer the same question: how do the pieces add up to the whole?

Who invented the pie chart?+

William Playfair created the first known pie chart in his 1801 Statistical Breviary, where he used it to show the proportions of the Turkish Empire located in Asia, Europe, and Africa. Florence Nightingale popularized a related variant — the polar area diagram — in 1858 to argue for sanitary reform after the Crimean War.

What’s the best library for building pie charts in code?+

For static, publication-quality pies, Matplotlib (Python) and ggplot2 (R, via geom_bar + coord_polar) are the standards. For interactive web pies, D3.js with d3.pie() and d3.arc() gives full control, while Chart.js, Plotly, ECharts, and Recharts get you to a working pie in a few lines.

// 18References

References and further reading

Primary sources, perception research, reference texts, and the official documentation for the libraries and tools referenced throughout this guide.

  • Encyclopedia entry covering the history, variants, and visual encoding of pie charts. A solid neutral starting point with citations to Playfair, Nightingale, and the Cleveland & McGill perception studies.
    https://en.wikipedia.org/wiki/Pie_chart
  • Playfair’s 1801 book containing the first known pie chart — a chart of the proportions of the Turkish Empire in Asia, Europe, and Africa. Hosted by the Internet Archive.
    https://archive.org/details/statisticalbrevi00play
  • The seminal experimental paper showing that humans judge length and position more accurately than angle or area — the empirical foundation for the recommendation to prefer bar charts over pies.
    https://www.jstor.org/stable/2288400
  • Stephen Few’s widely cited 2007 article arguing against the casual use of pie charts in business reporting. The most influential modern critique of the chart type.
    https://www.perceptualedge.com/articles/visual_business_intelligence/save_the_pies_for_dessert.pdf
  • Tufte’s foundational text on data graphics. The chapters on chartjunk and data-ink ratio explain why decorations like 3D and explosion damage every chart, pies included.
    https://www.edwardtufte.com/book/the-visual-display-of-quantitative-information/
  • Hands-on tutorial with real published examples covering slice limits, sorting from 12 o’clock, direct labelling, and when to switch to a bar chart instead.
    https://academy.datawrapper.de/article/127-what-to-consider-when-creating-a-pie-chart
  • Nightingale’s 1858 “rose diagram” — a polar variant of the pie chart she used to argue for sanitary reform after the Crimean War. One of the earliest examples of data visualization driving policy.
    https://en.wikipedia.org/wiki/Nightingale_rose_chart
  • Web Accessibility Initiative guidance on making charts accessible: text alternatives, long descriptions, and data tables. Use this as the source for the accessibility checklist.
    https://www.w3.org/WAI/tutorials/images/complex/
  • Official API reference for the Python pie chart helper used in this guide’s code sample, including options for startangle, counterclock, autopct, and wedgeprops.
    https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pie.html
  • Tidyverse documentation for coord_polar(), the function that turns a stacked bar into a pie chart in ggplot2. The package has no native geom_pie() by design.
    https://ggplot2.tidyverse.org/reference/coord_polar.html
  • Maintained Observable notebook from the D3 team showing the canonical pie / donut implementation with d3.pie() and d3.arc(), mirroring this guide’s JavaScript sample.
    https://observablehq.com/@d3/donut-chart/2
  • Open-source poster categorizing chart types by intent. Pie charts sit in the Part-to-whole family alongside donut, treemap, waffle, and stacked bar charts.
    https://github.com/Financial-Times/chart-doctor/tree/main/visual-vocabulary