[英]How to change regression model in seaborn pairplot
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: 我可以使用seaborns regplot
创建回归图,在其中可以使用order
选项更改线性回归模型的order
,也可以使用lowess=True
选项选择lowess模型,如下lowess=True
:
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
? 可以更改pairplot
线性回归的pairplot
吗?
Or even better, to use a lowess model in seaborn pairplot
? 甚至更好的是,在海洋pairplot
对图中使用最低模型?
For more advanced usage, use PairGrid
instead of pairplot
. 对于更高级的用法,请使用PairGrid
而不是pairplot
。 Basically, PairGrid
allows you to control which function is used to plot the upper, lower and diagonal plots independently. 基本上, PairGrid
允许您控制使用哪个函数分别绘制上,下和对角线图。 Check out the documentation for PairGrid for more details. 有关更多详细信息,请查看PairGrid的文档。
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'})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.