7. Seaborn#
This chapter introduces Seaborn as a higher-level tool for statistical graphics. You will use tidy data, plot families, faceting, and style controls to make comparisons clearer with less plotting code.
Tidy Data: Seaborn works best when each column is a variable and each row is one observation, so reshaping a table is often the first step.
Plot Families: Seaborn groups its functions by question: distribution plots show shape, relational plots show association, and categorical plots compare groups.
Semantic Mappings: Arguments such as
hue,style, andsizelet color, marker, and size carry a third variable without extra code.Faceting: Splitting one chart into small multiples by group makes comparisons across segments easier to read.
Themes and Palettes: A few style settings keep charts consistent, readable, and suitable for a manager audience.
Chapter Video
Video credit: Banas, D. (2020, September 1). Seaborn Tutorial : Seaborn Full Course. YouTube. Watch on YouTube (59:33).
This embedded video is provided for educational reference only. All rights are retained by the respective copyright holder.
Learning Objectives
By the end of this chapter, you will be able to:
Explain how pandas, Matplotlib, and Seaborn work together and choose a library for a plotting task.
Use tidy DataFrame columns to map variables to axes, color, and marker size.
Choose and create distribution, categorical, and relationship plots that answer a business question.
Use faceting with consistent scales to compare the same relationship or distribution across groups.
Apply themes, palettes, and labels to improve readability and explain the choices.
State a finding supported by a chart and explain a limitation, distinguishing individual observations from group summaries.
Optional extensions introduce direct FacetGrid construction, joint plots with fitted regression lines, and KDE construction. These provide exploration beyond the core objectives; regression is developed in Chapter 12.
Chapter Flow
Glossary
# |
Term |
Explanation |
|---|---|---|
1 |
Seaborn |
A Python library for statistical data visualization. |
2 |
Tidy data |
A table structure where each variable is a column and each observation is a row. |
3 |
Long format |
A tidy layout where repeated measurements are stored in rows. |
4 |
Wide format |
A table layout where related measurements are spread across columns. |
5 |
Plot family |
A group of Seaborn functions designed for a type of statistical question. |
6 |
Distribution plot |
A chart that shows the spread and shape of one variable. |
7 |
Categorical plot |
A chart that compares values across groups. |
8 |
Relationship plot |
A chart that shows association between variables. |
9 |
Regression plot |
A chart that overlays a fitted trend on paired data. |
10 |
Facet |
A small multiple panel split by a grouping variable. |
11 |
Hue |
A color mapping used to distinguish groups. |
12 |
Palette |
A set of colors used in a chart. |
13 |
Theme |
A reusable set of style choices. |
14 |
Estimator |
A summary function such as mean used inside some Seaborn plots. |
15 |
Confidence interval |
An uncertainty band around an estimated summary or trend. |
16 |
KDE |
A smoothed estimate of a distribution shape. |
17 |
Pair plot |
A grid that compares multiple numeric variables pairwise. |
18 |
Heatmap |
A color-coded display of values in a matrix. |
19 |
Context |
A Seaborn setting that scales plot elements for notebooks, talks, or papers. |
20 |
Legend |
A guide explaining visual encodings. |
21 |
Small multiples |
A set of similar charts repeated across groups. |