问题描述
我已经修改了@marcos answer 中的代码来处理我的数据。
我的数据框具有以下结构:
day x y
180604 12 54
180604 22 56
import seaborn as sns
import scipy as sp
data = cmp_dy[cmp_dy['day'].isin([180604,180605,180606,180607,180608,180609,180610])]
g = sns.lmplot(x='x',y='y',data=data,col='day',height=4,aspect=1)
def annotate(data,**kws):
r,p= sp.stats.pearsonr(data['x'],data['y'])
ax = plt.gca()
ax.text(.05,.8,'r={:.2f}'.format(r),transform=ax.transAxes)
g.map_dataframe(annotate)
plt.show()
请注意,我只在 col
方法中使用 lmplot
参数。因为 col 和 row 是相同的,即天。我的输出图如下所示。
我想要以 2 x 3 网格排列的图。或许马科斯方法可能不适合这里。我如何使用其他技术来实现这一点?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)