DistributionIntermediate

Density Plot

A smooth, continuous curve that estimates the probability distribution of a variable — like a histogram without the bins, revealing the true shape of your data.

// 01 — The chart

What it looks like

Example — Response time distributionn = 5,200 requests
0.0250.0200.0150.0100.0050Response time (ms)Peak

A density plot showing API response times. The smooth curve reveals a right-skewed distribution with most requests completing quickly.

// 02 — Definition

What is a density plot?

A density plot (also called a kernel density estimate or KDE plot) displays the distribution of a continuous variable as a smooth curve. Instead of sorting data into bins like a histogram, it places a small “kernel” (usually a bell curve) at every data point and sums them up to produce a continuous estimate of the underlying probability distribution.

The Y-axis shows probability density, not raw counts. This means the area under the entire curve always equals 1. A taller peak means values are more concentrated in that region; a flatter section means they’re spread out.

Density plots solve a key limitation of histograms: they don’t depend on arbitrary bin boundaries. This makes them especially useful when you want to compare the shapes of two or more distributions by overlaying them on the same axes.

Origin: Kernel density estimation was formalized by Murray Rosenblatt (1956) and Emanuel Parzen (1962). The technique grew out of the need for a non-parametric way to estimate probability density functions without assuming the data follows a specific distribution.

// 03 — Anatomy

Parts of a density plot

ABCDE
A — Y-axis (density): Shows probability density — the relative likelihood of values in a region
B — X-axis (variable): The continuous measurement being plotted (time, price, score)
C — Peak (mode): The highest point of the curve — where values are most concentrated
D — Curve shape: The KDE curve itself — its shape reveals skewness, multimodality, and spread
E — Filled area: The shaded region under the curve — total area always equals 1

// 04 — Usage

When to use it — and when not to

✓Use a density plot when…
  • You want to see the shape of a distribution without bin artifacts
  • Comparing two or more distributions on the same axis (overlay them)
  • You have a large dataset (500+ observations) and want a clean summary
  • Looking for multimodality — multiple peaks in the data
  • You need to estimate probability density rather than raw counts
  • Presenting results where a smooth curve is more visually polished
×Avoid a density plot when…
  • You have fewer than 30 observations — KDE will oversmooth noise
  • Exact counts matter — density doesn't show counts, only relative likelihood
  • Your data has hard boundaries (e.g., 0–100) — KDE bleeds past edges
  • The audience is unfamiliar with density — use a histogram instead
  • Your data is categorical — density only works for continuous variables
  • You need to show exact bin frequencies for regulatory or audit purposes

// 05 — Reading guide

How to read a density plot

Follow these steps whenever you encounter a density plot.

1

Read the axis labels

The X-axis shows the variable being measured. The Y-axis shows density — it tells you where values are concentrated, not how many there are.

2

Look at the overall shape

Is the curve symmetric, left-skewed, or right-skewed? Does it have one peak (unimodal), two peaks (bimodal), or more? The shape tells the story.

3

Find the peak (mode)

The highest point of the curve shows where values are most concentrated. This is the most likely value in your dataset.

4

Assess the spread

A narrow, tall curve means data is tightly clustered. A wide, flat curve means high variability. Compare the width at half-height for quick spread assessment.

5

Check the tails

Long tails suggest outliers or extreme values. A tail extending to the right (positive skew) is common in income, response time, and price data.

// 06 — Data format

What your data should look like

A density plot requires a single column of continuous numeric values. For overlaid density plots, add a grouping column.

valuegroup
142Server A
187Server A
203Server B
156Server A
298Server B

// Python example

import seaborn as sns
sns.kdeplot(data=df, x="value", hue="group", fill=True)

// 07 — Construction

How to build a density plot

1.

Collect your raw continuous data — the more observations, the better the estimate

2.

Choose a kernel function (Gaussian is standard) and a bandwidth parameter

3.

Place a kernel at each data point, then sum all kernels to form the density curve

4.

Normalize the curve so the total area under it equals 1

5.

Plot the resulting curve on X (variable) vs Y (density) axes

6.

Optionally shade the area under the curve and add a vertical line for the mode

// 08 — Pitfalls

Common mistakes

×

Wrong bandwidth

Too narrow creates a noisy, spiky curve. Too wide hides important features. Always experiment with bandwidth.

×

Ignoring boundary effects

KDE can produce density outside valid ranges (e.g., negative response times). Clip or use boundary-corrected methods.

×

Overlaying too many groups

More than 3–4 overlapping density curves become unreadable. Use ridgeline plots or facets instead.

×

Interpreting height as count

The Y-axis is density (probability per unit), not frequency. A peak at 0.02 doesn't mean 2% of data — the area between two X values does.

×

Too few data points

KDE on small samples (n < 30) creates a misleading smooth curve from essentially random noise.

// 09 — In the wild

Real-world examples

Finance

Overlaying the density of daily stock returns for two portfolios to compare risk profiles and tail behavior.

Healthcare

Plotting patient blood pressure readings as a density curve to see whether the sample follows a normal distribution.

Engineering

Comparing API response time distributions before and after a performance optimization, with two overlaid curves.

// 10 — At a glance

Quick reference

Also known asKDE plot, kernel density plot, probability density curve
CategoryDistribution
Data typeOne continuous numeric variable (optionally with a grouping column)
AxesX = measurement variable, Y = probability density
Minimum data30+ observations (ideally 200+)
Key parameterBandwidth — controls the smoothness of the curve
First usedRosenblatt (1956), Parzen (1962)

// 11 — Accessibility

Accessibility notes

&check;

Use high-contrast colors between overlaid curves — consider dashing or thickness differences

&check;

Always fill the area under curves with distinct patterns or semi-transparent fills

&check;

Provide a text summary: 'The distribution peaks at 310 ms with a right-skewed tail'

&check;

Add aria-labels describing the shape and key statistics (mean, median, spread)

&check;

For screen readers, provide a data table with percentile summaries as an alternative

// 12 — Variations

Variations

Overlaid density

Multiple density curves on the same axes for group comparison — use transparency for readability.

Mirrored density

Two densities mirrored vertically — used in half-eye and raincloud plots for compact comparison.

Filled vs. outline

Filled areas emphasize volume; outline-only curves work better when overlaying many groups.

2D density (contour)

Extends KDE to two dimensions, creating a contour map showing where bivariate data concentrates.

// 13 — FAQs

Frequently asked questions

What is a density plot?+

A density plot (also called a kernel density estimate or KDE plot) displays the distribution of a continuous variable as a smooth curve. Instead of sorting data into bins like a histogram, it places a small "kernel" (usually a bell curve) at every data point and sums them up to produce a continuous estimate of the underlying probability distribution.

When should you use a density plot?+

Use a density plot when you want to see the shape of a distribution without bin artifacts. It also works well when comparing two or more distributions on the same axis (overlay them), and when you have a large dataset (500+ observations) and want a clean summary.

When should you avoid a density plot?+

Avoid a density plot when you have fewer than 30 observations — KDE will oversmooth noise. It is also a poor fit when exact counts matter — density doesn't show counts, only relative likelihood, or when your data has hard boundaries (e.g., 0–100) — KDE bleeds past edges.

What data do you need to make a density plot?+

A density plot requires a single column of continuous numeric values. For overlaid density plots, add a grouping column.

Are density plots accessible to screen readers?+

Yes — a density plot can be made accessible to screen readers by pairing it with a clear text summary of the key insight, ensuring color choices meet WCAG contrast guidelines, adding descriptive alt text or aria-label to the SVG, and offering the underlying data as an HTML table fallback for assistive technologies.

Is a density plot suitable for dashboards?+

Yes — a density plot can work well in dashboards as long as the panel is large enough for readers to perceive the encoded values, has a clear title, and includes the legend or axis labels needed to interpret it.