Density Plot
Source: Data Visualisation Catalogue - Density Plot
Why This Belongs In The Compiler Gallery
Density plots are the first distribution chart in the gallery that requires more than summary statistics. They prove the compiler can estimate sampled density rows from raw observations and then render those rows through existing Cartesian path primitives.
Data Contract
Each raw row represents one observation.
| Field | Type | Purpose |
|---|---|---|
value | quantitative | Raw observed measure. |
density.value | quantitative, derived | Sampled x value emitted by the density transform. |
density.density | quantitative, derived | Estimated kernel density at the sampled value. |
bandwidth | quantitative, derived | Kernel bandwidth used for the estimate. |
Expected Visual
A faithful density plot should show one smooth distribution curve filled to a baseline. The current compiler version uses sampled density points and a smoothed baseline-closed path.
Compiler Mapping
| Compiler part | Mapping |
|---|---|
| Data source | observations raw table and derived density table. |
| Transform | density samples a Gaussian kernel estimate from raw values. |
| Scales | x: linear(value), y: linear(density). |
| Layers | Filled path closed to the x-axis baseline. |
| Guides | Generated x/y axes and gridlines. |
Faithfulness Notes
The key compiler gap closed here is data ownership: the curve is no longer hand-authored. Smooth path interpolation now covers the first visual form. Remaining work is grouped density policies, bandwidth controls, and richer density normalization options shared with violin plots.