首页 > 解决方案 > Python Seaborn 联合图未在图表上显示相关系数和 p 值

问题描述

我正在尝试用下面和从样本中绘制联合图,我看到它应该在图表上显示相关系数和 p 值。但是,它没有显示我的这些值。有什么建议吗?谢谢。

import seaborn as sns
sns.set(style="darkgrid", color_codes=True)
sns.jointplot('Num of A', ' Ratio B', data = data_df, kind='reg', height=8)
plt.show()

标签: pythonmatplotlibseaborn

解决方案


我最终使用下面来绘制

import seaborn as sns
import scipy.stats as stats

sns.set(style="darkgrid", color_codes=True)
j = sns.jointplot('Num of A', ' Ratio B', data = data_df, kind='reg', height=8)
j.annotate(stats.pearsonr)
plt.show()

推荐阅读