第二y轴时间序列seaborn

第二y轴时间序列seaborn,第1张

第二y轴时间序列seaborn

我建议使用法线图。您可以通过获取双轴坐标

ax.twinx()

import pandas as pdimport matplotlib.pyplot as pltdf = pd.Dataframe({"date": ["2018-01-01", "2018-01-02", "2018-01-03", "2018-01-04"],        "column1": [555,525,532,585],         "column2": [50,48,49,51]})ax = df.plot(x="date", y="column1", legend=False)ax2 = ax.twinx()df.plot(x="date", y="column2", ax=ax2, legend=False, color="r")ax.figure.legend()plt.show()



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5649189.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存