This entry is part of the Chart Index, the reference library for the Chart Design Field Guide.

A density plot is a histogram with the bins replaced by a smooth curve. The curve is a kernel density estimate (KDE): each observation contributes a small bump centred on its value, and the bumps are summed across the dataset. The result is a continuous estimate of the underlying probability density, free of the bin-width arbitrariness that makes histograms fragile.

That smoothness comes at a price. The curve invents structure between observations that the data does not contain. A KDE with the wrong bandwidth can show modes that are noise or hide modes that are real. The form is less honest than it appears: the smoothness reads as certainty, but every density curve is a choice.

What it is

A density plot represents a one-dimensional continuous distribution as a smooth curve. The y-axis is probability density — units of count per unit of x. The total area under the curve equals 1 (so the curve is a proper density), or equals the count (if scaled to a histogram for direct comparison). The curve is produced by kernel density estimation: each observation places a small kernel (usually Gaussian) at its value, and the kernels are summed.

The hero chart above compares request latency across three releases, each curve built from about 18,000 requests binned every 5 ms. The eye reads the centre, the spread, and — critically — the presence of modes and tails. Release 4.1 is the broad grey hump with its peak near 65 ms; 4.3 is tighter and faster. But it is 4.2, the orange curve, that tells the story a mean would miss: a secondary bump near 120 ms where a fraction of requests is hitting a slower code path. Randomise the counts and the bumps wobble; the second mode stays, because it is hundreds of requests wide.

When to use it

Density plots are the right choice when:

  • You have one continuous variable and want a smoothed view of its distribution.
  • The reader's question is "what is the shape of this distribution?" — modes, skew, tails.
  • You have enough observations for a kernel density estimate to be stable (typically ≥100).
  • You want to overlay or compare distributions — density curves overlap better than histograms.
  • You want to avoid bin-width arbitrariness — the bandwidth is a choice, but a continuous one.

When not to use it

  • Small samples. Below 50 observations, the KDE is fiction. Use a strip plot or jittered points.
  • Tail behaviour matters. KDEs smooth tails by design. For precise p99 or extreme-value reading, use a histogram, ECDF, or QQ plot.
  • Discrete or integer data with few unique values. A density curve over integers produces oscillating bumps that imply detail the data lacks. Use a histogram with integer bins.
  • Audiences unfamiliar with the form. The y-axis label density confuses non-statistical readers. Use a histogram for executive communication.

Design principles

Choose bandwidth deliberately and disclose it

Two density plots of the same data with different bandwidths look like two different datasets. State the bandwidth — Gaussian KDE, bandwidth 0.4 h — in the subtitle or footnote. If you tried several, name the one shown. The two figures below smooth the same 160 ticket resolution times with kernels more than an order of magnitude apart.

Bandwidth 0.15 h: every cluster of tickets is a peak
With a kernel narrower than the typical gap between observations the curve tracks sampling noise. There are two real modes here — quick answers near 1.5 hours and escalations near 8 — and a dozen spurious ones.
Bandwidth 2 h: the modes merge
The same tickets under a kernel more than ten times wider. The noise is gone — and so, very nearly, is the trough. The curve now says most tickets take a few hours with a long tail, which is a different and wrong story. Something near 0.5 hours is the honest choice for these data.

Use a closed shape with a baseline fill

Density curves can be drawn as lines or as filled regions. The filled region is more readable: the eye reads the shape as a single area, and overlapping curves can be partially transparent without losing identity. A bare line floats; it reads as a trend over time rather than as a quantity of stuff.

Line only: the curve reads as a time series
The hero's three releases with the fill removed. Nothing is wrong with the data, but the eye now follows the strokes as if they were trajectories and loses the sense that the area under each is a population of requests.

Limit overlays to two or three distributions

A density plot overlay scales as poorly as overlapping bars. Three curves work; four become hard to distinguish; six become illegible. For more distributions, use small multiples or a ridge plot.

Six overlaid densities: a tangle
Six regions' delivery times on one pair of axes. Each curve is fine on its own; together the fills muddy to brown, the legend is a lookup table, and no single region can be followed from foot to foot.
Two densities: the comparison the reader needs
The same data reduced to the two states the prose is actually about. The fastest and the slowest, one hue each, and the gap between them is the message.

Avoid filled overlays without alpha

Two overlapping filled densities at full opacity produce a third shape that is neither. Keep fills light — the figures here use under 20% — or use one line plus one fill for the same effect.

Show the rug or jitter strip below

A rug plot — small ticks along the x-axis marking each observation — anchors the density curve to the data. Without it, the smooth curve can imply more observations than exist; the rug makes the sample size visible. Where the tooling has no rug, state the n in the subtitle.

Pair with summary statistics

Mark the median (or mean) with a vertical reference line. State the n in the subtitle. The density shows the shape; the annotations carry the precision.

A quiet rule at the median
Release 4.2's latency with its median marked. The rule lands on the near side of the main hump, because the secondary mode at 120 ms drags half the requests further right than the peak suggests. The curve shows the shape; the rule gives the number.

Choose Gaussian unless you have a reason

The Gaussian kernel is the standard for good reason: smooth, symmetric, no edge artifacts. Alternative kernels (Epanechnikov, triangular) have theoretical advantages for some tasks but rarely matter for editorial work.

Anatomy

The composition of a density plot
An anatomical guide

A density plot's anatomy is the smooth curve plus its annotations: a rule for the centre, the n and the bandwidth in the subtitle, a rug for the observations where the tooling allows it. The curve is the editorial choice; everything else is honesty.

  • Histogram — the unsmoothed sibling. More honest about bin choice; less elegant overlays.
  • Violin plot — mirrored density across a vertical axis. Different layout, same KDE underneath.
  • Ridge plot — many density curves stacked. The form's panel-display answer.
  • ECDF — cumulative distribution function. The same data, different shape; better for tail behaviour.
  • Q-Q plot — for comparing a sample distribution against a reference. Different question.

Reading list

  • Silverman, B. (1986). Density Estimation for Statistics and Data Analysis. The foundational reference for bandwidth selection.
  • Wand, M. & Jones, M. (1995). Kernel Smoothing. The modern KDE handbook.
  • Cleveland, W. (1993). Visualizing Data. On density curves as visualisation tools rather than estimation tools.