Data Science · Chapter 15 of 43
Seaborn Basics
seaborn is a higher-level plotting library built on matplotlib. It ships great defaults and one-liner statistical plots.
Great for EDA — histplot, boxplot, heatmap, pairplot.
Example 1 (python)
import seaborn as sns
import pandas as pd
df = pd.read_csv('data.csv')
sns.histplot(df['age'], bins=20)Fast histogram with sensible defaults.
Example 2 (python)
sns.heatmap(df.corr(numeric_only=True), annot=True)Correlation heatmap.
Key points
- Built on matplotlib.
- Great defaults for statistical plots.
- Common plots: hist, box, bar, heatmap, pairplot.
- Ideal during EDA.
💡 Note: Use seaborn for exploration, matplotlib when you need pixel-perfect control.
