Seaborn Essentials
What
Statistical visualization built on matplotlib. Better defaults, easier syntax for common ML plots.
Key plots
import seaborn as sns
import pandas as pd
df = pd.read_csv("data.csv")
# Distribution of a feature
sns.histplot(df["age"], kde=True)
# Relationship between two features
sns.scatterplot(data=df, x="age", y="income", hue="gender")
# Correlation heatmap — spot feature relationships fast
sns.heatmap(df.corr(), annot=True, cmap="coolwarm", center=0)
# Distribution per category
sns.boxplot(data=df, x="category", y="value")
sns.violinplot(data=df, x="category", y="value")
# Pairwise relationships (small datasets only)
sns.pairplot(df, hue="target")When to use seaborn vs matplotlib
- Seaborn: EDA, statistical plots, quick exploration with DataFrames
- Matplotlib: custom layouts, publication figures, full control