La_*_*ine 1 python matplotlib python-2.7 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
Run Code Online (Sandbox Code Playgroud)
我想在同一个图中绘制系绳和比特币的运动,并且时间应该在 x 轴上可视化。我希望比特币和 Tether 能够按自己的大小进行缩放。我想在图片中有这样的东西(用 matplotlib 创建),但时间显示在轴上。我不关心包,只关心结果......我使用的是 Python 2.7。
Tether vs 比特币 Var%
这只是一个标准plot():
df.set_index(pd.to_datetime(df.date), drop=True).plot()
Run Code Online (Sandbox Code Playgroud)
要添加网格和辅助 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)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8953 次 |
| 最近记录: |