Python Seaborn jointplot does not show the correlation coefficient and p-value on the chart

user2784820 picture user2784820 · Aug 31, 2018 · Viewed 15.8k times · Source

I'm trying to plot jointplot with below and from samples I saw it should show the correlation coefficient and p-value on the chart. However it does not show those values on mine. Any advice? thanks.

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()

Answer

user2784820 picture user2784820 · Aug 31, 2018

I ended up using below to plot

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()