sns.scatterplot shows the relationship between two numeric variables — like Matplotlib's scatter, but with grouping by a third (or fourth) variable built in via hue, size and style.
Basic scatter
sns.scatterplot(data=tips, x="total_bill", y="tip")
Grouping with hue/size/style
These map extra columns to visual channels automatically — colour, marker size, marker shape — with a legend:
sns.scatterplot(data=tips, x="total_bill", y="tip",hue="time", # colour by lunch/dinnersize="size", # marker size by party sizestyle="smoker", # marker shape by smoker)
Key takeaways
- 01sns.scatterplot(data=, x=, y=) shows relationships between two variables.
- 02hue colours points by a column; size scales them; style changes the marker.
- 03Seaborn builds the legend automatically from those mappings.
- 04You can encode up to four variables on one scatter.
