xxxxxxxxxx
>>> import seaborn as sns; sns.set(style="ticks", color_codes=True)
>>> iris = sns.load_dataset("iris")
>>> g = sns.pairplot(iris)
xxxxxxxxxx
import seaborn as sns
# Pair Grid
g = sns.PairGrid(df, vars=["col1", "col2"])
g = g.map_diag(sns.histplot) # Diagonally show histogram
g = g.map_offdiag(sns.scatterplot) # Off-diagonally show scatterplot
# Alternative and easier approach : Pairplot
sns.pairplot(df, vars=["col1","col2"], kind="reg",
diag_kind="hist", hue="BEDRMS",
palette="husl", plot_kws={"alpha": 0.5})
xxxxxxxxxx
# importing packages
import seaborn
import matplotlib.pyplot as plt
############# Main Section ############
# loading dataset using seaborn
df = seaborn.load_dataset('tips')
# pairplot with hue sex
seaborn.pairplot(df, hue ='sex')
# to show
plt.show()
# This code is contributed by Deepanshu Rustagi.
xxxxxxxxxx
import seaborn as sns
sns.set_theme(style="ticks")
df = sns.load_dataset("penguins")
sns.pairplot(df, hue="species")