AJ528
AJ528

Reputation: 23

Is it possible to add KDE estimation to hisgram in a pairplot plot with seaborn?

I'm ploting a pairplot plot with seaborn (See figure). I would like to add to the histograms the KDE estimations. Is it possible? Besides, is it possible to make the histogram less opaque in order to better see both of them? Thank you

enter image description here

Upvotes: 1

Views: 443

Answers (1)

Bidur
Bidur

Reputation: 91

If I understand correctly, this might address your requirements

import seaborn as sns

sns.set(style="ticks")

df = sns.load_dataset("iris")
p = sns.PairGrid(df, vars=['sepal_length', 'sepal_width'], hue="species")
p = p.map_offdiag(sns.scatterplot)
p = p.map_diag(sns.distplot, hist=True, kde=True, hist_kws={'alpha':0.5})

Here is the screenshot..

enter image description here

Upvotes: 2

Related Questions