SAMANTUS Python for Data Analytics — Complete Training Manual CHEAT SHEET 05
← Back to Course Index

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

ChartSyntax
Box Plotsns.boxplot(data=df, x='cat', y='value')
Violin Plotsns.violinplot(data=df, x='cat', y='value')
Histogram/KDEsns.histplot(data=df, x='value', kde=True)
Scatter with Regressionsns.regplot(x='x', y='y', data=df)
Heatmapsns.heatmap(corr_matrix, annot=True)
Pair Plotsns.pairplot(df, hue='category')

CS5.2  Categorical Plots

► Bar & Count 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

► Correlation Heatmap
corr = df[["col1","col2","col3"]].corr()
sns.heatmap(corr, annot=True, cmap="Oranges", fmt=".2f")
plt.title("Correlation Heatmap")

CS5.4  Styling & Themes

CommandPurpose
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.