Introduction
Advanced Seaborn visualizations for statistical analysis.
Categorical Plots
import seaborn as sns
# Strip plot
sns.stripplot(x="category", y="value", data=df, jitter=True)
# Swarm plot (no overlap)
sns.swarmplot(x="category", y="value", data=df)
# Box plot with hue
sns.boxplot(x="category", y="value", hue="region", data=df)
Regression Plots
# Basic regression
sns.regplot(x="feature", y="target", data=df)
# With confidence intervals
sns.lmplot(x="feature", y="target", data=df, ci=99)
# Polynomial regression
sns.regplot(x="x", y="y", data=df, order=2)
FacetGrid
g = sns.FacetGrid(df, col="category", row="region")
g.map(plt.hist, "value")
g.add_legend()
Practice Problems
- Create faceted plots by multiple variables
- Customize regression plots
- Build pair plots with custom colors
- Use catplot for complex categoricals
- Create joint distribution plots