A stacked bar chart is a bar chart in which each bar is divided into segments that represent subcategories, so that the full bar length shows a category total and each segment shows that subcategory’s contribution to the total. In data visualization, it answers two questions at once: how large each category is, and what it is made of.
The form is common in business reporting, survey analysis and operational dashboards. Its strength is part-to-whole comparison across several categories; its main weakness is that only the bottom segment shares a common baseline, which makes the other segments hard to compare precisely.
How a stacked bar chart encodes data
A stacked bar chart maps each category to a bar and each series to a colored segment placed end to end along the value axis. The length of a segment encodes its value, its color encodes the series, and the combined length encodes the sum. Bars can run vertically, often called a stacked column chart, or horizontally, which suits long category labels.
Perception research on graphical encoding ranks position along a common scale as the most accurate visual channel and length without a common baseline as less accurate. In a stacked bar, the first segment and the total sit on the shared baseline, while every middle segment floats. Readers therefore judge totals and the bottom series well, but middle segments poorly.
The following table summarizes what each visual element carries and how reliably viewers read it.
| Element | Encodes | Reading accuracy |
|---|---|---|
| Total bar length | Category sum | High, common baseline |
| First segment | Baseline series value | High, common baseline |
| Middle segments | Other series values | Low, floating start points |
| Segment color | Series identity | Depends on palette and legend |
| Bar order | Category sequence or rank | High when sorted meaningfully |
Absolute, percentage and diverging variants
Stacked bar charts come in three main variants that suit different questions. The absolute stacked bar shows raw values, so bar lengths differ. The 100% stacked bar, also called a percentage stacked bar, normalizes every bar to the same length and shows shares rather than amounts. The diverging stacked bar centers the bars on a midpoint, which is the preferred form for Likert-scale survey results.
| Variant | Shows | Best for | Loses |
|---|---|---|---|
| Absolute stacked | Totals and parts in units | Revenue by region and product | Precise comparison of upper segments |
| 100% stacked | Composition as shares | Market share, channel mix | Information about totals |
| Diverging stacked | Negative and positive sides of a midpoint | Agree and disagree survey scales | Simple reading of totals |
| Grouped bar | Parts side by side, not stacked | Comparing individual series | Direct view of totals |
A 100% stacked bar should be labeled clearly as percentages, and the underlying sample size of each bar should be shown, because equal bar lengths hide very different totals.
Stacked bars compared with related charts
Several neighboring chart types show part-to-whole relationships, and the right choice depends on how many categories, how many parts and whether time is involved. A pie chart or donut chart shows composition for a single whole, an area chart shows composition over a continuous time axis, and a treemap handles hierarchical parts at many levels.
| Chart | Number of wholes | Strength | Weakness |
|---|---|---|---|
| Stacked bar chart | Several categories | Totals and composition together | Middle segments hard to compare |
| Pie or donut chart | One | Instant share of a single whole | Angles compare poorly |
| Stacked area chart | Continuous time series | Shows trends in composition | Upper layers distort visually |
| Treemap | One hierarchy | Many nested parts | Area judged less accurately than length |
| Small multiples | Many | Each series on its own baseline | Uses more space |
Design practices for readable stacked bars
Good design compensates for the chart’s weak points. The most useful rule is to place the most important series at the baseline, since only that series is read accurately. Categories should be sorted by total or by a meaningful order, not alphabetically, unless the audience needs to look up a specific label.
- Limit segments to about five; beyond that, merge small series into an Other group.
- Keep segment order and colors identical across all bars and related charts.
- Use a sequential palette for ordered series and a categorical palette for unordered ones, with sufficient contrast for color-blind readers.
- Label segments directly when space allows, which removes the need to match colors to a legend.
- Start the value axis at zero, because truncated axes distort both totals and segment lengths.
Libraries such as Matplotlib, D3.js and most business intelligence tools support stacking through a single option, but defaults often order segments by data order and assign colors arbitrarily, so manual configuration is usually required.
Interactive versions add value through tooltips that show exact segment values and through legends that let viewers isolate one series. Isolating a series temporarily moves it to the baseline, which turns a hard length judgment into an accurate position judgment.
Limitations and common misreadings
The chart becomes misleading when it is used for a question it cannot answer well. Asking viewers to compare a middle segment across bars produces slow and inaccurate judgments, and negative values break the stacking logic unless a diverging layout is used.
| Problem | Cause | Fix |
|---|---|---|
| Viewers misjudge a middle series | No common baseline | Move it to the bottom or use small multiples |
| Rainbow of thin slivers | Too many series | Group minor series as Other |
| Totals misread in 100% charts | Normalization hides size | Add totals or sample sizes |
| Negative values overlap | Mixed signs in one stack | Use a diverging stacked bar |
Put simply
Picture a row of glass jars, each holding layers of different colored sand. The height of each jar shows how much sand it holds in total, and the colored layers show what the total is made of. A stacked bar chart works the same way, with bars instead of jars.
It is easy to see which jar is fullest and how thick the bottom layer is. Layers in the middle are harder to compare, because they start at different heights. That is why the most important layer belongs at the bottom.
In practice
A regional hospital network reports monthly emergency department visits for its four sites. An analyst builds a horizontal stacked bar chart with one bar per site and three segments: walk-in patients, ambulance arrivals and referrals. Ambulance arrivals sit at the baseline because the board’s question concerns ambulance capacity.
The chart shows at a glance that the largest site handles about 6,200 visits a month, and that ambulance arrivals account for nearly 40 percent there, compared with roughly 20 percent at the other sites. A second, 100% stacked version placed alongside makes that share difference explicit. The board uses the pair of charts to approve an additional ambulance bay at the busiest site.