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 more 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.
Three releases, each as a density curve. The eye reads the centre, the spread, and (critically) the presence of modes and tails. The release with a long right tail and a secondary bump tells a story the means cannot — a fraction of requests is hitting a different code path.
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 — in the subtitle or footnote. If you tried several, name the one shown.
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.
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; five become illegible. For more distributions, use small multiples or a ridge plot.
Avoid filled overlays without alpha
Two overlapping filled densities at full opacity produce a third shape that is neither. Drop opacity to 0.3–0.5, or use one-line plus one-filled 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.
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.
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
A density plot's anatomy is the smooth curve plus its annotations: rug for observations, median line for centre, bandwidth in the subtitle. The curve is the editorial choice; everything else is honesty.
Related types
- 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.