我一直在从事python / seaborn / scipy.stats / matplotlib.pyplot等新手的数据分析工作 .
Seaborn Correlation Coefficient on PairGrid此链接帮助我通过皮尔森R得分呈现我的变量之间的关系 . 然而,由于Pearsons测试的输出也应该具有p值以指示统计显着性,我正在寻找将P值添加到我的图上的注释的方法 .
g = sns.pairplot(unoutlieddata, vars=['bia', 'DW', 'HW', 'jackson', 'girths'], kind="reg")
def corrfunc(x, y, **kws):
r, _ = sps.pearsonr(x, y)
ax = plt.gca()
ax.annotate("r = {:.2f}".format(r),
xy=(.1, .9), xycoords=ax.transAxes)
g.map(corrfunc)
sns.plt.show()
显示的是我提供的链接格式的代码 . SPS = scipy.stats . 未提供的数据是已过滤以删除异常值的数据帧
任何想法都是神奇的
问候
1 回答
不确定是否有人会看到这个,但在与知道更多的人交谈后,答案如下
代码
结果