Course contentsShow
← Data Science
Lesson 1283 of 2,14532. Visualization with Matplotlib and SeabornFree lesson

Joint Plots and Bivariate Distributions

Creating jointplot to show relationships between two variables with marginal distributions.

Joint Plots and Bivariate Distributions

What you'll learn: How to use Seaborn's jointplot() to visualize the relationship between two variables while simultaneously seeing their individual distributions.

The Core Idea

A joint plot combines three visualizations into one: a central scatter plot (or other bivariate plot) showing the relationship between two variables, plus marginal distributions (histograms or KDEs) along the top and right edges showing each variable's univariate distribution. Think of it as getting both the "big picture" relationship and the individual profiles in a single, compact view.

This is particularly powerful during exploratory data analysis because you can quickly assess:

  • Whether two variables are related (central plot)
  • How each variable is distributed individually (marginal plots)
  • Whether outliers or clusters exist in either dimension

Using jointplot()

Seaborn's jointplot() creates this combined visualization automatically:

import seaborn as sns
import matplotlib.pyplot as plt

# Load example data
tips = sns.load_dataset('tips')

# Create a joint plot
sns.jointplot(data=tips, x='total_bill', y='tip')
plt.show()

You can customize the plot type for both central and marginal visualizations:

# Hexbin for the center, KDE for margins
sns.jointplot(data=tips, x='total_bill', y='tip', 
              kind='hex', marginal_kws={'kde': True})
plt.show()

Common kind options include 'scatter' (default), 'kde', 'hex', and 'reg' (regression).

Why This Matters

Joint plots save you from creating three separate visualizations and mentally stitching them together. They're especially useful when you want to understand conditional patterns—like whether high values in one variable correspond to specific distributions in another.

Key Takeaway: Joint plots give you a three-in-one view: the bivariate relationship in the center with univariate marginal distributions on the sides, making them ideal for comprehensive relationship exploration.