Part II · Advanced topics · Chapter 6

Part-to-whole and hierarchies

Some charts are about position and some are about proportion. This chapter covers the second kind — pies and donuts, waffles, rose and radar charts, treemaps, marimekko charts and alluvial diagrams — and they nearly all come from the same two moves: pick a mark, and subdivide it.

The one idea

Nothing in this chapter is a chart type you switch to. Each of them is a mark shape plus Subdivision, and once that clicks the family stops needing to be memorized:

ChartMarkPlus
PieRadial chartA category on Subdivision
DonutRadial chartThe same, with an inner radius above zero
Semi-circle donutRadial chartThe same, with a sweep angle of 180°
WaffleWaffleA category on Color, Subdivision or Shape, counted in cells
RoseRadial chart, rose typeSlices of equal angle, varying radius
RadarRadial chart, radar typeSeveral variables read on radial axes
TreemapRectangleA category on Subdivision, a number on Size
Stacked barBarA category on Subdivision
AlluvialAlluvialTwo or more categories, as stages of a flow

A stacked bar and a pie are the same encoding on different marks. That is worth knowing because the choice between them is then purely about which reads better — not about rebuilding anything.

Circular charts

With the mark set to radial chart, Chart type picks the variant: pie, rose or radar. Two more shape the geometry, and they are what produce the familiar named variants:

  • Inner radius — zero gives a pie; anything above it opens the hole and gives a donut. The hole is not decoration: it removes the centre, where the angles are hardest to compare, and leaves room for a total in the middle.
  • Start angle and sweep angle — where the first slice begins and how much of the circle is used. A sweep of 180° is the semi-circle donut; rotating the start angle puts the largest slice where you want the eye to land.

For rose charts, Mapping by: decides whether the variable drives the Radius of each petal or its Area. This is a real choice with a right answer in most cases: radius exaggerates differences, because a petal twice as long covers four times the area. Mapping to area is the honest option unless you specifically want the amplification.

Radar charts get their own grid and label colours, since the web of concentric rings and radial axes is drawn independently of the marks.

Pies have a narrow good range

People judge angles poorly. A pie works when there are few slices — three or four — and the point is a rough share rather than a comparison, or when one slice dominates and that is the message.

Beyond about five slices, or when slices are close in size, a bar chart answers the same question better. If you find yourself labelling every slice with its percentage because the shapes are not readable, the chart is telling you something.

Pie

A pie chart of the populations of nine countries of similar size — Niger, Romania, Syria, Chile, Kazakhstan, the Netherlands, Guatemala, Ecuador and Cambodia — each slice between about 10 and 12.5 percent, so the slices look almost equal.

Sorted bars

The same nine populations as a bar chart sorted from largest to smallest, from Niger at about 19.9 million down to Cambodia at about 15.6 million, in the same colors as the pie.
Figure 1 — The same proportions, twice. Both are correct; one can be read.

Waffle charts

A waffle is the answer to the angle problem. It takes the pie's encoding — a category on Color or Subdivision, a number on Size, or the row count without one — and draws it as a grid of equal cells, 10 × 10 by default. Each category fills cells in proportion to its value, so 40% is forty cells. Shares are counted rather than estimated.

  • The grid is never set by hand. Where a space bounds the waffle — the chart alone, the cells of a categorical axis, a small multiple — its 100 cells take the shape that best fits it: 10 × 10 in a square space, 20 × 5 in a wide one. If the space is so small that 100 cells would be tinier than half a mark of that Size, the waffle drops to 10 cells (5 × 2, 10 × 1), each worth 10%. Where nothing bounds it — a map, a scatter plot — it is a 10 × 10 square whose cells are as big as a circle mark of that size. Fill order decides whether cells fill by rows or by columns, which reads like a stacked bar, and Start picks the corner they fill from: Bottom left makes a waffle that fills upwards, like a rising bar. Corner radius rounds square cells, empty ones and legend samples included.
  • Shape divides too: each cell takes the shape of its category, and with Color and Shape on different variables every combination gets its own run of cells. Under Cell shape you can pick a built-in shape or upload an icon of your own; with a variable on Color the icon is painted in the colour of its category — a pictogram — and with a Fill colour of your choice, in that one.
  • Scale decides what a cell is worth. With Part of whole every waffle is a whole of its own, in 100 cells; give it a Whole — 100 when the values are percentages — and each waffle fills only its share of that, with the rest drawn as empty cells. With Proportional every cell is worth the same amount in every waffle: the grid fills the space with cells as big as a circle mark of that Size, each cell is worth the round number with which the largest waffle fills it, the cells left over are drawn empty, and the legend says what one cell is worth. A smaller size gives more, finer cells, and Cell value sets the worth of a cell by hand. That is the setting for comparing waffles side by side.
Cells are whole

Values are rounded to whole cells. The leftover cells go to the largest remainders, so the grid always adds up, and a category too small for half a cell can get none. The exact value is still in the tooltip.

Waffles go wherever pies go: one per unit, one per cell of a categorical axis, one per small multiple, or on a map. With Avoid overlap each waffle moves as a block.

Treemaps and hierarchies

A treemap fills a rectangle with rectangles, each sized by value. It handles what a pie cannot — many categories, wildly different magnitudes — because area survives crowding better than angle, and it nests.

Nesting is the part that catches everyone out, so it is worth stating plainly:

How to nest

The variable whose values are the rectangles goes on Subdivision. Each further categorical variable adds an outer level that groups them, and there are two ways to add one.

Put the parent on Color: children are then grouped inside their parent and share its colour. Or put it on Subdivision too, before the child: every variable on Subdivision except the last one forms a level, from the outermost in, so Region, Country and City nest cities inside countries inside regions.

Both can be combined; the variable on Color is always the outermost level.

Sunburst diagrams are the radial form of the same structure, with the parent on Color.

Two practical notes. Label placement matters more here than elsewhere, because small rectangles cannot hold text — Marks to label and Amount of labels to be shown are how you label the blocks that have room and leave the rest to the tooltip. And treemaps have no axes, so exact values are unavailable by construction: readers compare areas approximately and read the rest on hover.

To name the groups, put their variable on Label as well. It is then written once, as a header at the top of each group, instead of in every rectangle. Its entry on Label gets a Group header section:

  • Show as group header, on by default. Unchecked, the variable is written in every rectangle again.
  • Header text, a template of its own. Other columns in it are aggregated over the whole group: [Region] ([Market trade volume]) shows each region with its total volume.
  • Font, size, colour and opacity apart from the rest of the labels, which they follow until you set them. Coloured as the marks paints each header in its group's colour, and Ensure contrast darkens or lightens that colour just enough to stand out from the background.

A header that does not fit in its group is left out, and its rectangles show the variable again. Right-clicking a header opens its section directly.

Under Marks in the chart settings, Corner radius rounds the rectangles, as it rounds bars. Labels stay inside each rectangle, within its border, and start where the corner curve ends, like the text of a rounded button, however wide the border is. Labels inside rounded bars and Gantt bars keep the same distance from a rounded end.

A nested treemap of market trade volume: Region on Color and Country on Subdivision, so four colored regional blocks are each divided into one rectangle per country, next to the property panel showing both assignments.
Figure 2 — A nested treemap and the encoding that produced it.

Marimekko and variable-width bars

A stacked bar shows the composition of each group, but every bar is equally wide, so a small group weighs as much as a large one. A marimekko chart gives the groups their weight too: each column is as wide as its share of a total, and its segments are stacked inside it. Nothing new is needed to build one — bars, and a number on each axis:

  • On X-axis | columns, the category of the columns and then the number that sizes them — Region, then Population. Each column is as wide as Population adds up to in that region.
  • On Y-axis | rows, the number the segments are stacked by, and the parts on Color.

Between the columns and their names, an axis measures the width variable, from zero at the start of the first column to the total at the end of the last; it hides like any axis, from the panel of that variable. For the classic marimekko, where every column reaches 100%, stack by a Percentage column instead (see Data types) with the region ticked under Calculate total by, so each row is a share of its own column. With the category and the width on Y-axis | rows and the stacked number on X, the columns become horizontal bands.

Without a category on either axis — one number on X, another on Y — each row becomes its own bar, or each group once Unit or Color gathers them: as wide as its X value, as tall as its Y value, one after another. That is a variable-width bar chart. Countries with Population on X and GDP per capita on Y give bars whose area is the GDP of each country.

Width encodes data in both, so Bar width is not offered: every bar fills its band, and a border is what separates the segments. In a marimekko, Corner radius rounds all four corners of each segment. The chart wizard has both, as Marimekko Chart and Variable Width Bar Chart.

Alluvial diagrams

An alluvial diagram shows how a population divides at one stage and redivides at the next: categories as vertical stacks, flows between them as bands whose width is the quantity moving. It is the chart for composition across stages rather than at one.

It suits questions with a "from what to what" in them — which regions supply which markets, how a cohort moves between categories, where a budget goes on its way from source to use. What it does not suit is a plain breakdown: if there is only one stage, a bar chart is doing the same work with less ink.

Keep the number of stages small. Two or three read well; beyond that the crossings dominate and the diagram becomes a decorative tangle. Sorting the categories at each stage — see the sort options in An introduction to aggregation — reduces crossings considerably and is the first thing to try when one gets messy.

Choosing

You want to showUse
A rough share, few categoriesPie or donut
A share to be counted, or parts of several wholes comparedWaffle, Proportional to compare
A precise ranking of partsSorted bar chart
Many parts, very different sizesTreemap
Two levels of hierarchyTreemap or sunburst, parent on Color
Composition compared across groupsStacked bars, or small multiples of them
Composition across groups of very different sizeMarimekko
Composition changing between stagesAlluvial
Several measures for a few entitiesRadar — sparingly

That is the manual

You have the whole grammar now: data in, types corrected, variables encoded onto visual properties, rows grouped and aggregated, filters applied, text and interaction added, and the specialized treatments for maps, networks, clusters, trends, distributions and proportions.

What is left is practice, and the most useful next step is not another chapter — it is the Viz Catalogue. Every example there is a real project you can open in the app and take apart, which is the fastest way to see how the pieces in this manual combine into finished work.