Relational Plots: scatterplot with hue & size mapping0%
Relational Plots: scatterplot with hue & size mapping
Beginner12 min read•Updated: Jul 11, 2026
Relational Plots: scatterplot with hue & size mapping
Reading Time: 8 Mins | Level: Intermediate
1. Visualizing Relationships Between Continuous Variables
To understand how two numeric variables interact (e.g. Advertising Spend vs Revenue, or Engine Size vs Fuel Efficiency), use sns.scatterplot().
2. Multi-Dimensional Encoding (Hue, Size & Style)
In a single 2D plane, Seaborn can visualize up to 5 variables simultaneously through aesthetic dimension mapping:
- X-axis: Numeric Variable 1
- Y-axis: Numeric Variable 2
hue: Categorical Variable 3 (Color)size: Numeric Variable 4 (Marker bubble diameter)style: Categorical Variable 5 (Marker shape: circle, cross, triangle)
Python
import seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset('tips')
fig, ax = plt.subplots(figsize=(9, 6))
sns.scatterplot(
data=df,
x='total_bill',
y='tip',
hue='time', # Color by Lunch vs Dinner
size='size', # Bubble size by table party size (1 to 6 people)
sizes=(30, 250),
style='smoker', # Shape by Smoker Yes/No
palette='deep',
alpha=0.8,
ax=ax
)
ax.set_title('Tip Amount vs Total Bill (Multivariate Relationship)')
ax.set_xlabel('Total Bill (USD)')
ax.set_ylabel('Tip Given (USD)')
plt.show()
Interactive Quiz
Multiple Choice Questions
Question 1
Which parameter in
sns.scatterplot() scales the diameter of points based on a numeric column (creating a bubble chart)?Question 2
How can you add a linear regression best-fit trendline to a scatter plot in Seaborn?
Question 3
What does setting
alpha=0.5 do in a dense scatter plot with thousands of overlapping points?Question 4
Which parameter changes the marker shape (e.g. circles, squares, diamonds) based on a categorical variable?
Question 5
What does a positive correlation look like on a scatter plot?
Next Lesson
Correlation Heatmaps & PairPlots for Multivariate EDA
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Related Lessons
Practice Quiz
Test your understanding of this lesson with 5 questions. Each question has one correct answer.