Vega-Lite Violin Plot
A violin plot — a box plot's prettier cousin that shows the full distribution shape via a kernel-density estimate mirrored on either side of each category. Vega-Lite produces this by combining the `density` transform (built-in KDE) with a horizontal area mark and `xOffset` to mir
Template details
- chart
- violin
- distribution
- kde
- vega
- vega-lite
When to use this template
A violin plot reveals the full shape of a quantitative distribution across different categories, making it easy to spot nuances like multi-modality, skewness, and kurtosis that summary statistics alone cannot capture. Analysts use it to compare how distributions differ between groups, especially when understanding the spread and density at various points is more critical than just comparing medians or quartiles.
- Comparing a quantitative variable's distribution across distinct categories.
- Datasets where the full shape of distributions (e.g., multi-modality, skew) is important.
- When a categorical variable has a moderate number of unique values (e.g., 3-15).
- Raw data or pre-calculated density estimates for each group.
- Identifying differences in density and spread between groups.
- When a box plot's summary of five numbers is insufficient.