Seaborn Statistical Charts
ECON 3209 · Week 5, Lecture 2 · Kerala Agricultural University
Department of Development Economics, KAU
Autumn 2026
Why Seaborn?
- Seaborn builds on Matplotlib but offers better default styling
- It is especially strong for statistical visualisation
- Many exploratory charts require fewer lines of code in seaborn
- It works naturally with pandas DataFrames
- Economists often use it for quick, informative exploratory analysis
A Distribution Plot
- Historically, seaborn users often learned
distplot
- Newer versions prefer
histplot(..., kde=True)
- Both show the distribution and a smooth density curve
- Distribution charts help detect skewness and spread
Boxplots for Spread and Outliers
- The box shows the interquartile range
- The line inside the box is the median
- Points beyond the whiskers may be outliers
- Boxplots help compare distributions across groups quickly
Heatmaps for Correlation Structure
- Heatmaps are excellent for seeing many correlations at once
- Colour intensity reveals stronger positive or negative association
- Annotation helps when an audience needs exact values
- Heatmaps are descriptive tools, not causal evidence
Pairplots for Many Relationships
- Pairplots combine scatter plots and univariate distributions
- They quickly reveal relationships, clusters, and scale differences
- They are useful in early exploratory work on small-to-medium datasets
- Large datasets may require sampling to stay readable
Seaborn Works Best with DataFrames
- Seaborn usually expects “long” or tidy DataFrames
- Column names become plot variables such as
x, y, and hue
- This makes code more expressive than passing many separate arrays
- It also connects naturally to the pandas workflows from Week 4
- Good data wrangling improves charting quality immediately
Reading Statistical Graphics Carefully
- A pretty chart is not automatically informative
- Ask what variable is being summarised and in what units
- Distinguish between distribution shape, central tendency, and outliers
- Correlation patterns can reflect scale or omitted factors
- Use economic context to interpret, not just visual intuition
Visualisation should sharpen your questions before modelling — not replace careful econometric reasoning.
Combining Seaborn and Matplotlib
- Seaborn handles style and statistical defaults elegantly
- Matplotlib still gives fine-grained control over titles and axes
- In practice, analysts often use both libraries together
- This combination is powerful and flexible for teaching and research
Choosing Among Seaborn Charts
Use These When
- Distribution plot: shape of one numeric variable
- Boxplot: compare spread across groups
- Heatmap: inspect many correlations
Also Remember
- Pairplot: multi-variable exploration
- Too many variables create clutter
- Always label variables clearly
Summary
- ✅ seaborn provides attractive defaults for statistical graphics
- ✅ Distribution plots, boxplots, heatmaps, and pairplots answer different questions
- ✅ seaborn works especially well with pandas DataFrames
- ✅ Statistical charts help reveal spread, outliers, and association
- ✅ Matplotlib and seaborn are usually used together, not separately
- ✅ Clear interpretation still matters more than visual polish alone
Next Lecture
- We will build multi-panel charts and improve formatting
- You will learn saving options, annotations, and presentation standards
- This turns exploratory plots into polished communication tools