Distributions

Distribution charts show how the values of one measure spread out, where most of them fall and how groups differ in shape.

LLMs

Usage

When to show how values are spread out, which distribution chart fits the question, and how to draw one that does not hide the data. The same rules hold in every chart library. For picking between chart types in general, see Choosing a chart.

What it is for

A distribution chart shows how the values of one measure are spread out: where most of them sit, how wide the range is, whether there are two peaks, and which values are unusual. A histogram, a box plot, a violin, a density curve and a beeswarm all answer that question at a different level of detail.

When to use

  • The reader asks what a typical value is and how far the others stray, such as order values or response times.
  • An average alone would mislead, because the data is skewed or has two groups in it.
  • You compare the spread of several groups, such as delivery times per warehouse. Use box plots or violins side by side.
  • You need the share of values below a limit, such as how many requests finish under 200 ms. Use a cumulative distribution.

Use something else when

  • You compare one total or average per category. Use a bar chart.
  • You show how two measures relate to each other. Use a scatterplot.
  • The values change over time and the trend matters. Use a line chart, with a band for the spread if it matters too.
  • There are fewer than about twenty values. Show every value with a dot plot or a beeswarm instead of a summary.
  • The audience does not know how to read a box plot. Use a histogram, or a dot plot with the median marked.

How it reads

  • Histogram: the range is cut into equal bins and each bar is the count in a bin. Tall bars are where values crowd.
  • Box plot: the box spans the middle half of the values, the line inside is the median, the whiskers reach the furthest values that are not outliers, and dots past them are outliers.
  • Violin and density: a smoothed outline of the histogram. A wide part means many values there.
  • Cumulative distribution: for any value on the horizontal axis, the height is the share of values at or below it.
  • Beeswarm: every value is a dot, pushed aside so none overlap.

Do it well

  • Try a few bin sizes before you pick one. Too few bins hide the shape, too many turn it into noise. Use round bin edges the reader can name, such as steps of 5.
  • Keep the same bins and the same axes across histograms you compare, or the shapes cannot be compared.
  • Show how many values each group has, in the label, the tooltip or the subtitle. A box plot looks the same for 8 values and for 8,000.
  • Compare groups of different sizes as shares, not counts, so the bigger group does not look more spread out.
  • Start the count axis of a histogram at zero. Its bars are lengths, like a bar chart's.
  • Say in the subtitle what the whiskers or the error bars mean, such as one standard deviation or the 1.5 times range rule.

Pitfalls

  • A box plot hides the sample size and the shape. Two peaks, gaps and a handful of values all look like the same box. Add the points or the count, or use a violin.
  • Smoothing that invents data. A density curve or violin can show values below zero or between real groups. Check it against a histogram.
  • Gaps between histogram bars. The bins cover a continuous range, so the bars should touch, or nearly touch.
  • A bar of averages with error bars and nothing else. It hides how the values are spread. Show the distribution.
  • Ridgelines that overlap so much the lower ridges cannot be read. Keep the overlap small and the shapes simple.

Variants

  • Histogram: counts per bin over one continuous range.
  • Cumulative histogram: each bar counts every value up to its bin.
  • Cumulative distribution: a step line of the share of values at or below each value, with no bins.
  • Box plot: quartiles, median and outliers per group.
  • Violin: the smoothed shape of each group, side by side.
  • Ridgeline: one smoothed shape per group, stacked and partly overlapping, for many groups.
  • Beeswarm: every value as a dot, for small and medium data.
  • Error bars: a mean and a range per group, when the reader knows what the range means.
  • Faceted histograms: one histogram per group on shared axes.
  • Waffle: a grid of cells where each cell is one unit of a whole, such as one percent.

Compared with similar charts

  • Histogram against bar chart: a histogram's bars are bins of one continuous measure and touch. A bar chart's bars are separate categories with gaps.
  • Box plot against violin: a box plot gives five numbers and the outliers, a violin gives the whole shape. Use a box plot for many groups and a violin when the shape matters.
  • Histogram against cumulative distribution: a histogram shows where values crowd, a cumulative distribution shows percentiles and needs no bin size.
  • Beeswarm against histogram: a beeswarm keeps every value but stops working past a few hundred points.