我的时间序列需要帮助。我有一个内置在pandas中的数据框架:
date bitcoin tether
91 2017-11-01 0.0444 0.0001
90 2017-11-02 0.0426 0.0000
89 2017-11-03 0.0181 0.0000
88 2017-11-04 0.0296 0.0000
87 2017-11-05 0.0035 0.0000
86 2017-11-06 -0.0582 0.0000
85 2017-11-07 0.0206 0.0000
84 2017-11-08 0.0481 0.0100我想将系绳和比特币的运动一起绘制在同一个图中,时间应该在x轴上可视化。我希望比特币和系绳能按自己的大小进行缩放。我希望在图片中有这样的东西(用matplotlib创建),但在轴上显示时间。我不关心包,只关心结果……我用的是Python 2.7。
Tether vs比特币Var%

发布于 2018-07-28 20:51:39
这只是一个标准的plot()
df.set_index(pd.to_datetime(df.date), drop=True).plot()

要添加网格和次要y轴,请使用plot()参数:
df = df.set_index(pd.to_datetime(df.date), drop=True)
df.bitcoin.plot(grid=True, label="bitcoin", legend=True)
df.tether.plot(secondary_y=True, label="tether", legend=True)

https://stackoverflow.com/questions/51571507
复制相似问题