如何解决Seaborn lmplot 与 facetgrid
我已经修改了@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 举报,一经查实,本站将立刻删除。