Education8 min read

What is a Violin Plot and When Should You Use It?

By Francesco Villasmunta
What is a Violin Plot and When Should You Use It?

The violin plot is one of the most elegant and informative charts in modern data science. It combines the summary statistics of a box plot with the density estimation of a histogram. But for many, it remains a mystery.

What is a Violin Plot?

A violin plot depicts distributions of numeric data for one or more groups using density curves. The width of each curve corresponds to the approximate frequency of data points in each region. Densely populated areas are wider, while sparsely populated areas are narrower.

Violin Plot vs Box Plot

Why use a violin plot instead of the classic box plot?

Box Plot

Shows summary statistics: Median, IQR (25th-75th percentile), and outliers.

Limitation: It hides the shape of the distribution. A bimodal distribution (two peaks) looks the same as a unimodal one.

Violin Plot

Shows the full distribution shape (KDE) plus summary statistics inside.

Advantage: Reveals hidden patterns like multiple peaks (multimodality) that box plots miss.

When to Use a Violin Plot

  • Large Datasets: When you have enough points to estimate density smoothly.
  • Comparing Distributions: When you want to compare the shape of data across groups (e.g., gene expression in Control vs Treated).
  • Detecting Multimodality: When you suspect your data has subpopulations (e.g., fast and slow responders).

How to Create One

Creating violin plots in Excel is difficult (see our guide here).

The easiest way is to use Plotivy. Just upload your data and ask for a violin plot. You can even combine it with a box plot inside for the ultimate data summary.

Visualize Your Distribution

Create a beautiful violin plot in seconds.

Create Violin Plot Free →

Chart gallery

Gallery starters for distribution plots

Jump to violin, box, and density plot recipes with prompts and images you can regenerate instantly.

Browse all chart types →
Violin plot comparing score distributions across 3 groups with inner box plots
Distributionseaborn, matplotlib
From the chart galleryComparing treatment effects across groups

Violin Plot

Combines box plots with kernel density to show distribution shape across groups.

Sample code / prompt

Create a violin plot comparing 'Exam Scores' across 3 treatment groups: Control, Treatment A, and Treatment B. Generate realistic educational data with 50 students per group. Control: mean=72, sd=12 (normal). Treatment A: mean=78, sd=10 (slight improvement). Treatment B: mean=82, sd=8 (significant improvement, less variance). Include embedded box plots showing quartiles, median line, and mean diamond marker. Add individual data points as a strip plot with jitter (alpha=0.3). Perform and annotate ANOVA p-value. Use distinct colors for each group. Add horizontal reference line at passing score (70). Title: 'Effect of Study Interventions on Exam Performance'.
Box and whisker plot comparing gene expression across 4 genotypes with significance brackets
Distributionseaborn, matplotlib
From the chart galleryComparing experimental groups in scientific research

Box and Whisker Plot

Displays data distribution using quartiles, median, and outliers in a standardized format.

Sample code / prompt

Create a publication-ready box plot comparing 'Gene Expression Levels' (normalized counts) across 4 genotypes: WT (Wild Type), KO1 (Knockout 1), KO2 (Knockout 2), and Mutant. Generate a realistic dataset with n=20 biological replicates per group, with KO1 showing upregulation (~1.5x WT), KO2 showing downregulation (~0.8x WT), and Mutant showing moderate increase (~1.2x WT). Overlay jittered individual data points with transparency. Perform pairwise t-tests against WT control and add significance brackets with stars (* p<0.05, ** p<0.01, *** p<0.001, ns for non-significant). Use a colorblind-friendly palette, add y-axis label with units, and include sample size (n=) in x-axis labels.
Density plot showing distribution of test scores with shaded area
Distributionseaborn, matplotlib
From the chart galleryComparing distributions between groups

Density Plot

Visualizes the distribution of data over a continuous interval using kernel density estimation.

Sample code / prompt

Create a density plot (KDE) showing the distribution of 'SAT Scores' for 1000 students across 3 school districts. Generate realistic data: District A (urban, mean=1100, sd=150), District B (suburban, mean=1200, sd=120), District C (private, mean=1300, sd=100). Shade the area under each curve with semi-transparent fills using distinct colors. Add vertical dashed lines for each district's mean with annotations. Include a vertical line at the national average (1060). Add a rug plot showing individual observations (alpha=0.1). X-axis: 'SAT Score (400-1600)', Y-axis: 'Density'. Add legend with district names and sample sizes. Title: 'SAT Score Distribution by School District'.

Start Analyzing Today

You don't need to be a data scientist to analyze data like one. Try Plotivy and turn your data into insights in minutes.

Get Started for Free →
Tags:#violin plot#data visualization#education#statistics