I have the following code, and it creates the plot perfectly but I want to have the beta, as well as the R2 for each graph.
g = sns.lmplot(data=corr, x="price", y="transactions", col="year", ci=95, fit_reg=True, col_wrap=3, scatter_kws={'linewidths':0.5,'edgecolor':'w'})
def annotate(data, **kws):
r, p = sp.stats.pearsonr(corr['price'], corr['transactions'])
ax = plt.gca()
ax.text(.05, .8, 'r={:.2f}, p={:.2g}'.format(r, p), transform=ax.transAxes)
g.map_dataframe(annotate)
plt.show()
but somehow the r2 and the p value are all the same across graphs, why?