Pair Plots
Why pair plots?
Pair plots are a fast way to inspect:
- Pairwise relationships between variables
- Distributions on the diagonal
- Group separation using
huehue
They are great early in EDA.
Basic pairplot
pairplot
import seaborn as sns
penguins = sns.load_dataset("penguins").dropna()
sns.pairplot(penguins[[
"bill_length_mm",
"bill_depth_mm",
"flipper_length_mm",
"body_mass_g",
]])pairplot
import seaborn as sns
penguins = sns.load_dataset("penguins").dropna()
sns.pairplot(penguins[[
"bill_length_mm",
"bill_depth_mm",
"flipper_length_mm",
"body_mass_g",
]])Pairplot with hue
pairplot with hue
import seaborn as sns
penguins = sns.load_dataset("penguins").dropna()
sns.pairplot(
penguins,
vars=["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"],
hue="species",
)pairplot with hue
import seaborn as sns
penguins = sns.load_dataset("penguins").dropna()
sns.pairplot(
penguins,
vars=["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"],
hue="species",
)Tips
- Pair plots can be slow for large datasets. Sample rows if needed.
- Use
huehueto check if groups separate naturally.
If this helped you, consider buying me a coffee ☕
Buy me a coffeeWas this page helpful?
Let us know how we did
