Seaborn — Beautiful Statistical Charts in Python
Heatmaps, pairplots, violin plots. Built on Matplotlib, Seaborn turns one-line code into presentation-ready charts that interviewers love.
Seaborn turns one-line code into statistical charts that Matplotlib makes painful. Master these six and you’ll handle any EDA round.
Distribution Plots
histplot, kdeplot, displot — understand the shape of one variable at a time. The first move in any EDA session.
- histplot with kde=True
- kdeplot for smooth density
- Multiple distributions on one axis
Categorical Plots
boxplot, violinplot, stripplot — compare distributions across categories. A staple of A/B test and product analytics interviews.
- boxplot for outlier detection
- violinplot for full distribution
- countplot for category sizes
Relational Plots
scatterplot, lineplot — visualise relationships between two numerical variables, optionally split by a third.
- scatterplot with hue and size
- lineplot with confidence bands
- relplot for faceted grids
Heatmaps & Correlation
heatmap — the easiest way to spot correlated features. Essential in any ML or feature-engineering interview round.
- sns.heatmap(df.corr())
- annot=True to show values
- cmap=’coolwarm’ diverging scale
Pairplot & FacetGrid
pairplot for all-vs-all relationships; FacetGrid for splitting any chart by a categorical column.
- sns.pairplot(df, hue=’label’)
- FacetGrid(col, row, hue)
- catplot kind=’box’ or ‘bar’
Themes & Palettes
set_theme, color_palette — clean styling without Matplotlib boilerplate. Saves critical time in live coding tests.
- sns.set_theme(‘whitegrid’)
- palette=’viridis’ or ‘Set2’
- context=’talk’ for presentations
A staple of EDA rounds. Spot which features correlate with the target — and which are redundant.
“Compare distributions across two dimensions” — the hue parameter is the key move here.
Seaborn questions are usually paired with statistical reasoning — not just “make this chart”.
The functions that handle 90% of EDA tasks in analyst interviews.
| Function | Purpose |
|---|---|
| sns.set_theme(style) | Apply global style — whitegrid, ticks, dark |
| sns.histplot(data, x, kde) | Histogram with optional density curve |
| sns.boxplot(data, x, y, hue) | Distribution comparison with outliers |
| sns.violinplot(data, x, y) | Full distribution shape comparison |
| sns.scatterplot(data, x, y, hue) | Two numerics plus a category |
| sns.lineplot(data, x, y) | Time series with confidence bands |
| sns.heatmap(matrix, annot, cmap) | Coloured grid for correlation matrices |
| sns.pairplot(df, hue) | All-pairs scatter matrix |
| sns.countplot(data, x) | Bar chart of category frequencies |
| sns.regplot(data, x, y) | Scatter with regression line |
| sns.catplot(kind=’bar’) | Categorical charts with faceting |
| sns.color_palette(‘Set2’) | Apply a custom colour scheme |
Ready to ace your EDA round?
Practise Seaborn charting questions with feedback on chart choice and statistical reasoning.
Book Free Seaborn Session