Stacked bar chartTotals and what makes them up.
Each bar is a total, cut into its parts end to end. Compare the totals by length, and see what builds each one.
- Answers What share does each part have?
- Your data parts per category
- Parts 2 to about 5
- Bars 3 to 20
- Excel and Power BI built in
- Bread
- Cakes
- Coffee
What is a stacked bar chart?
A stacked bar chart is a bar chart where each bar is cut into parts laid end to end. The whole bar is the total, and each segment is one part of it. It compares totals across categories and shows what each total is made of, in one picture.
A bakery sells bread, cakes and coffee in four shops. Stacked bars show that the station shop sells the most in total, mostly coffee, while the old town shop lives on cakes.
Why use a stacked bar chart?
Because it shows totals and their parts at the same time.
- Totals compare. The full length of each bar is its total, from one baseline.
- Parts show their weight. A long segment is a big part of that total.
- One chart, two questions. Which shop sells most, and what does it sell?
- Built in everywhere. Excel, Power BI and Python.
How does a stacked bar chart work?
Three steps stack parts into a total.
- Step 1 of 3A bar per shopThe shops down the side, the sales along the bottom from zero.
- Bread
- Cakes
- Coffee
- Step 2 of 3One bar, part by partBread from zero, cakes from where bread ends, then coffee: 12 + 8 + 22.
- Bread
- Cakes
- Coffee
- Step 3 of 3Every shop the same wayEach bar's end is its shop's total.
- Bread
- Cakes
- Coffee
What are the parts of a stacked bar chart?
Four parts, and each one has a job.
- Bread
- Cakes
- Coffee
- First segmentstarts at zero, so it reads exactly
- Next segmentstarts where the last one ends
- Bar endthe total of all parts
- Value axisthe scale, from zero
How do you read a stacked bar chart?
Three looks, in this order.
- Compare the totalsThe longest bar is the biggest shop: the station, 42.
- Bread
- Cakes
- Coffee
- Read the first partBread starts at zero, so it compares exactly: the market sells most bread.
- Bread
- Cakes
- Coffee
- Read the biggest segmentThe old town's longest segment is cakes: 18 of 34.
- Bread
- Cakes
- Coffee
What kinds of stacked bar chart are there?
The same parts, three ways.
- Kind 1StackedParts end to end: the total.
- Bread
- Cakes
- Coffee
- Kind 2100% stackedEvery bar full length: the shares.
- Bread
- Cakes
- Coffee
- Kind 3GroupedParts side by side: each part compares exactly.
- Bread
- Cakes
- Coffee
When should you use a stacked bar chart?
When both the totals and their make-up matter.
- each category has parts that add up to a total
- the totals matter
- there are 2 to about 5 parts
- the first part is the one to compare most
- only the shares matter (100% stacked bars)
- each part must be compared exactly (grouped bars)
- there are many parts (a table or small multiples)
- values can be negative (grouped bars)
Stacked or grouped bars?
Stacked for totals, grouped for comparing the parts.
- Bread
- Cakes
- Coffee
- Bread
- Cakes
- Coffee
Grouped bars start every part at zero, so cakes in one shop compare exactly with cakes in another; the totals must be added in your head. Stacked bars give the totals for free, but only the first part starts at zero; the others float.
How do you make a stacked bar chart?
Built in everywhere: Excel, Power BI, Google Sheets and Python.
In Excel, choose Insert > Bar chart > Stacked bar. In Power BI, it is the stacked bar chart visual, with the part in the legend. The bar chart settings are in bar charts in Power BI. In Python, matplotlib draws one with plt.barh and its left argument.
What goes wrong with stacked bar charts?
The most common mistake, and its fix: comparing the floating parts.
- cakes start at a different spot in every bar
- whether one shop sells more cakes than another is a guess
- put the part that matters most first, from zero
- write values on the others, or use grouped bars
| Mistake | Why it hurts | Fix |
|---|---|---|
| Comparing middle segments | They start at different spots | First segment for the key part, or grouped bars |
| Too many parts | Thin slivers of colour | 2 to 5 parts, "others" for the rest |
| Bars in no order | The eye hunts for the biggest | Sort by total |
| Parts in a different order per bar | Colours jump around | One fixed order |
| Negative parts | Segments fold back over others | Grouped bars |
Every chart for “What share does each part have?”
- One wholePie chartA circle cut into slices, for a few shares of one total.
- One wholeDonut chartA pie with a hole, with room for the total in the middle.
- One wholeWaffle chartA grid of 100 squares, each one per cent.
- One wholeParliament chartSeats in a half circle, coloured by party.
- Shares across groups100% stacked bar chartEvery bar the same length, split into shares.
- Shares across groupsMarimekko chartStacked bars whose width is also a value, for two levels of share.
- Nested partsTreemapRectangles sized by value, nested by level.
- Nested partsSunburst chartRings of a hierarchy, from the centre out.
- Nested partsIcicle chartA hierarchy as rows of blocks, each split into its children.
- Nested partsCircle packingCircles inside circles, sized by value, for a hierarchy.
- Building up to a totalWaterfall chartSteps up and down from a start to an end, for what changed a total.
- Building up to a totalPolar area chartWedges of equal angle whose length shows the value.
Read on, step by step.
Does it fit your data? Try it.
Paste your table into Chart Compass, say what the chart should show, and see the charts that fit, drawn with your own numbers. It runs in your browser, so the data stays with you.