We can also create scatter plots combined with other plots. One of the easiest ways to do this is the lmplot method from seaborn, we can use it to create multiple plots with regression lines.
import pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsurl ="https://raw.githubusercontent.com/dataprofessor/data/refs/heads/master/penguins_cleaned.csv"penguins = pd.read_csv(url)penguins.head()
This figure plots the different species of penguins in different colors, separated by sex (columns) and island (rows). Each subplot contains a scatter plot of flipper length vs body mass, along with a regression line for each species.
We can also create joint plots withe seaborn that combine scatter plots with histograms or density plots.