Density / KDE Plot
Variant: Standard
Made-up data, for demonstration only
Variants
5 types · click one to see it in the frame above- Difference from standard
- The recommended type; use it as a starting point
- Use when
- See the shape of a distribution as a smooth curve
Density Plot is a smooth curve that shows where numeric values cluster, like a smoothed histogram. The curve is high where values are common. Use it to see the shape of a distribution, such as the time users spend in an app each day.
How to read a Density Plot
- The horizontal axis is the value. In this example it is minutes per day, from 0 to 60.
- The height of the curve is density. The higher the curve, the more data sits there. The total area under the curve is 1, so you cannot read head counts from the numbers on the vertical axis.
- The peak is at about 11 minutes. Most users open the app for about 6 to 23 minutes (a range covering about 80% of the typical users). The median is 13 minutes, marked by the dashed line.
- The tail runs long to the right. The mean of 15 minutes is above the median because a small number of users spend more than 30 minutes (13 out of 300 people). The longest is about 48 minutes.
- The data is 300 made-up values. The curve is estimated from the generated values with kernel density estimation, so it does not show each data point directly.
When to use it
- You want to see the shape of a continuous numeric distribution. Checking the distribution of each variable one at a time is the first job to do with new data.
- There is enough data. A density plot is reliable with a large data set, but it can mislead with just a few points.
- You want to compare the distributions of several groups that are well separated. Continuous curves help the eye tell groups apart, better than stacked histograms.
- You want to catch data errors. A comb shape often means the data was rounded or contains another kind of error.
When not to use it
- There is little data. The smooth curve makes the data look denser than it is. Use a Strip Plot or a Beeswarm Plot to show every point.
- The possible values have a limit, such as time that cannot be negative. The curve tends to run past the limit into values that cannot exist.
- Curves from several groups overlap until they cannot be told apart. Try separate charts, or use a Violin Plot, a Box Plot or a Ridgeline Plot.
- Readers need to count things. Use a Histogram.
Common mistakes
1. Choosing the bandwidth without checking
The bandwidth is the width of the small curve drawn around each data point. The value you pick changes the result a lot. Too narrow, and the curve is spiky and cluttered. Too wide, and small features disappear. Try the "Narrow bandwidth" and "Wide bandwidth" variants and compare them.
2. The curve runs past impossible limits
Kernel density estimation (KDE) often makes it look as if there is data where there is none, especially in the tails. Check that the curve does not predict values that make no sense, such as negative minutes.
3. Not showing the real data
A smooth curve hides how many data points there are. Try the "Show actual data ticks" variant, which puts small ticks for the data along the base.
4. Reading the height as a number of people
The height is density. If you need counts, use a histogram, or say that the area under the curve equals 1.
5. Comparing groups that overlap heavily
Try the "Compare two groups" variant, with old customers and new customers. If the curves overlap almost completely they are hard to read. Use fewer colours or separate the charts.
Compared with similar charts
| Chart | How it differs | Choose it when |
|---|---|---|
| Density Plot | A smooth curve | You want the shape of the distribution and compare a few groups |
| Histogram | Bars that count values per range | You want to see counts |
| Violin Plot | A curve mirrored on both sides of an axis | You compare several groups |
| Ridgeline Plot | Curves stacked with a slight overlap | Many groups that follow an order |
| Box Plot | A box of summary values | You compare groups and want to see outliers |
History and development
The kernel density estimation method behind this chart goes back to research by Murray Rosenblatt, published in 1956, and by Emanuel Parzen, published in 1962, both in The Annals of Mathematical Statistics. Both papers are about estimating a density function. They are not evidence that this kind of chart came into use in those years.
Frequently asked questions
How is a Density Plot different from a Histogram?
A Histogram counts values per range and draws bars. A Density Plot draws a small curve at each data point and adds them up into one smooth line. Both answer the same question.
What bandwidth should I use?
There is no fixed value. Try several and see whether the main shape stays the same.
Why does the area under the curve equal 1?
Because it is a probability density: the sum over all possible values is 1. When you show several groups of different sizes, some charts scale the area to the size of each group.
Can I use it with little data?
It is not recommended. The smooth curve makes the data look denser than it is. Use a chart that shows every point.
References
- Fundamentals of Data Visualization, ch. 7: Visualizing distributions: Histograms and density plots · Claus O. Wilke · clauswilke.comUsed to confirm: histograms and density plots, and choosing bins and bandwidth
- Density plot · Data to Viz · www.data-to-viz.comUsed to confirm: how to read a density plot and what to watch for
- Remarks on Some Nonparametric Estimates of a Density Function · Rosenblatt, M. (1956) · The Annals of Mathematical Statistics, 27(3), 832–837 · doi.orgUsed to confirm: the origin of the kernel density estimate method (Rosenblatt 1956)
- On Estimation of a Probability Density Function and Mode · Parzen, E. (1962) · The Annals of Mathematical Statistics, 33(3), 1065–1076 · doi.orgUsed to confirm: the origin of the kernel density estimate method (Parzen 1962)
Last updated 28 Nov 2026