Scatter plots
Seaborn basics
1 min read
This section is 1 min read, full guide is 42 min read
Published Oct 7 2025, updated Aug 17 2026
24
Show sections list
0
Log in to enable the "Like" button
0
Guide comments
0
Log in to enable the "Save" button
Respond to this guide
Guide Sections
Guide Comments
ChartsGraphsMatplotlibNumPyPandasPythonSeabornVisualisation
seaborn.scatterplot() is used to create scatter plots in Python. Scatter plots are great for visualising the relationship between two numerical variables, optionally with additional categorical information using colour, size, or style.
Syntax:
sns.scatterplot( data=None, x=None, y=None, hue=None, style=None, size=None, palette=None, markers=True, sizes=None, **kwargs)Parameters:
data→ DataFrame containing the data.x,y→ Columns to plot on X and Y axes.hue→ Column name for colour encoding (categorical or numeric).style→ Column for marker shapes.size→ Column to scale marker sizes.palette→ Colours for hue categories.markers→ Whether to use different marker shapes.sizes→ Range of sizes for markers.
Basic example
import seaborn as snsimport matplotlib.pyplot as plt# Sample datadata = sns.load_dataset("iris")# Simple scatter plotsns.scatterplot(data=data, x="sepal_length", y="sepal_width")plt.show()This will plot sepal length vs. sepal width for all iris flowers.

Using hue (colour)
import seaborn as snsimport matplotlib.pyplot as pltdata = sns.load_dataset("iris")sns.scatterplot(data=data, x="sepal_length", y="sepal_width", hue="species")plt.show()Points are coloured by species.

Using style and size
import seaborn as snsimport matplotlib.pyplot as pltdata = sns.load_dataset("iris")sns.scatterplot( data=data, x="sepal_length", y="sepal_width", hue="species", style="species", size="petal_length", sizes=(20, 200))plt.show()- Style: different marker shapes for species.
- Size: marker sizes proportional to petal length.

Customising appearance
import seaborn as snsimport matplotlib.pyplot as pltdata = sns.load_dataset("iris")sns.scatterplot( data=data, x="sepal_length", y="sepal_width", hue="species", palette="bright", s=100, edgecolor="black")plt.show()palette="bright"→ colorful markerss=100→ marker sizeedgecolor="black"→ black border around markers
