Reputation: 3428
I can create regression plot with seaborns regplot
, where I can change the order of the linear regression model with the order
option, or choose a lowess model with the lowess=True
option as in:
sns.regplot(x='logAssets', y='logLTIFR', lowess=True, data=df, scatter_kws={'alpha':0.15}, line_kws={'color': 'red'})
and obtain this:
Is it possible to change the order of the linear regression in a pairplot
?
Or even better, to use a lowess model in seaborn pairplot
?
Upvotes: 2
Views: 2521
Reputation: 40667
For more advanced usage, use PairGrid
instead of pairplot
. Basically, PairGrid
allows you to control which function is used to plot the upper, lower and diagonal plots independently.
Check out the documentation for PairGrid for more details.
To answer your specific question:
iris = sns.load_dataset("iris")
g = sns.PairGrid(iris)
g = g.map_upper(sns.regplot, lowess=True, scatter_kws={'alpha':0.15}, line_kws={'color': 'red'})
Upvotes: 4