Page6/13
Box Plots & Outlier Detection · Page 1 of 1
Anatomy of a Box Plot
Box Plots & Outlier Detection
Why Box Plots?
Histograms hide exact percentiles. Box plots show the 5-number summary visually:
- Minimum (Q1 - 1.5 * IQR)
- Q1 (25th percentile)
- Median (50th percentile)
- Q3 (75th percentile)
- Maximum (Q3 + 1.5 * IQR)
Outliers
Any points outside the "whiskers" (min/max) are plotted as individual dots. These are statistical outliers.
Violin Plots
A combination of a box plot and a KDE (density) plot. It shows the shape of the distribution in addition to the summary statistics.
import seaborn as sns
sns.boxplot(x='category', y='value', data=df)
sns.violinplot(x='category', y='value', data=df)
Data Science Use: Box plots are step 1 in anomaly detection (fraud, server crashes, sensor errors).
main.py
Loading...
OUTPUT
▶Click "Run Code" to execute…