Seaborn Cheat Sheet
On This Page
Bonus Chapter: Seaborn Cheat Sheet
Quick reference for the Seaborn statistical charting syntax covered in Module 15.
CS5.1 Statistical Chart Types
| Chart | Syntax |
|---|
| Box Plot | sns.boxplot(data=df, x='cat', y='value') |
| Violin Plot | sns.violinplot(data=df, x='cat', y='value') |
| Histogram/KDE | sns.histplot(data=df, x='value', kde=True) |
| Scatter with Regression | sns.regplot(x='x', y='y', data=df) |
| Heatmap | sns.heatmap(corr_matrix, annot=True) |
| Pair Plot | sns.pairplot(df, hue='category') |
CS5.2 Categorical Plots
sns.barplot(data=df, x="category", y="value") # bar with mean + error bars
sns.countplot(data=df, x="category") # count of rows per category
sns.boxplot(data=df, x="category", y="value", hue="group") # grouped box plot
CS5.3 Correlation & Relationships
corr = df[["col1","col2","col3"]].corr()
sns.heatmap(corr, annot=True, cmap="Oranges", fmt=".2f")
plt.title("Correlation Heatmap")
CS5.4 Styling & Themes
| Command | Purpose |
|---|
| sns.set_style('whitegrid') | Apply a clean grid theme |
| sns.set_palette('Set2') | Set a color palette |
| palette=['navy','orange'] | Custom color list for a plot |
| hue='column' | Color-code points/bars by a category |
| sns.despine() | Remove top/right chart borders |
✓ Instructor Tip
Seaborn works directly with Pandas DataFrames — always pass data=df and refer to column names as strings, rather than extracting arrays manually.
ℹ Reminder
Full explanations and worked examples for every chart type are in Module 15 of the main training manual.