Seaborn in practice
Produce a pairplot, a correlation heatmap, and a catplot from a DataFrame — all in runnable code.
- Produce a pairplot from a multi-column DataFrame
- Produce a correlation heatmap with sns.heatmap()
- Produce a grouped catplot with hue
This lesson runs through the four seaborn plots described in the previous lesson. Each block is self-contained. The output is saved to a file rather than displayed inline because the in-browser runner does not open windows, but all numeric outputs are printed so you can verify the plots are correct.
Pairplot
The correlation output tells you numerically what the scatter plots show
visually: which variables have the strongest linear relationship with score.
Negative correlations appear as downward-sloping scatter plots in the grid.
Correlation heatmap
annot=True writes the correlation value inside each cell. fmt=".2f" formats
it to two decimal places. cmap="coolwarm" gives a diverging colour scale —
blue for negative, red for positive — centred at zero with vmin/vmax/center.
Catplot with hue
sns.catplot() returns a FacetGrid object (g), not an Axes. To set
the title use g.fig.suptitle(). To customise individual axes within the
grid, iterate over g.axes.flat.
Where to go next
Next: anatomy of a good chart — the data-ink ratio principle, accessible colour choices, and how to annotate meaningfully without cluttering your chart.
Seaborn statistical plots
Seaborn understands DataFrames and adds statistical awareness — learn when pairplot, heatmap, catplot, and boxplot each reveal insight.
Anatomy of a good chart
Data-ink ratio, accessible colour palettes, and targeted annotation — the principles that separate clear charts from cluttered ones.