What is a joint plot?
A joint plot shows:
- A bivariate relationship (scatter/KDE/hex)
- Marginal distributions on the sides
It’s a compact EDA tool.
flowchart TD A["x, y columns"] --> B["Center panel:
scatter / KDE / hex"] A --> C["Top margin:
histogram of x"] A --> D["Right margin:
histogram of y"]
Joint plot (scatter + hist)
import seaborn as sns
tips = sns.load_dataset("tips")
sns.jointplot(data=tips, x="total_bill", y="tip", kind="scatter")Joint plot with KDE
import seaborn as sns
tips = sns.load_dataset("tips")
sns.jointplot(data=tips, x="total_bill", y="tip", kind="kde", fill=True)Visualize it
The center shows how the two variables relate; the strips along the top and right edges show each variable's own shape, on its own:
Tips
- For large data,
kind="hex"is useful to reduce overplotting. - Joint plots are figure-level, so customization is slightly different.
Check your understanding
What does a jointplot show besides the relationship between two variables?
The center shows the bivariate relationship and the edge strips show each variable on its own.
Show answer
B — Marginal distributions along the top and right edges — The center shows the bivariate relationship and the edge strips show each variable on its own.
Which kind is suggested for large data to reduce overplotting?
Hexagonal binning counts points per cell, so dense data stays readable.
Show answer
D — kind="hex" — Hexagonal binning counts points per cell, so dense data stays readable.
Why can you not easily place a jointplot inside an existing plt.subplots() grid?
Figure-level functions such as jointplot, pairplot and lmplot create their own figure, unlike axes-level regplot or scatterplot.
Show answer
C — It is figure-level and manages its own figure — Figure-level functions such as jointplot, pairplot and lmplot create their own figure, unlike axes-level regplot or scatterplot.
Which call draws a filled KDE joint plot of total_bill and tip?
kind="kde" swaps the scatter for density contours and fill=True shades them.
Show answer
A — sns.jointplot(data=tips, x="total_bill", y="tip", kind="kde", fill=True) — kind="kde" swaps the scatter for density contours and fill=True shades them.
Next
Continue to Pair Plots to see every pairwise relationship across several variables at once.
🧪 Try It Yourself
Exercise 1 – A Basic Joint Plot
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.Exercise 2 – Switch the Center Panel to KDE
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.Exercise 3 – Reduce Overplotting With Hex
Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.
Press Run to see what your code prints.