【发布时间】:2016-01-03 12:18:20
【问题描述】:
我想在 matplotlib 中为 x 轴指定带有时间的完整日期,但使用自动缩放我只能获得时间或日期,但不能同时获得两者。以下代码:
import matplotlib.pyplot as plt
import pandas as pd
times = pd.date_range('2015-10-06', periods=500, freq='10min')
fig, ax = plt.subplots(1)
fig.autofmt_xdate()
plt.plot(times, range(times.size))
plt.show()
在 x 轴上,我只得到没有任何日期的时间,因此很难区分测量值。
我认为这是 matplotlib.dates.AutoDateFormatter 中 matplotlib 中的一些选项,但我找不到任何可以让我更改自动缩放的选项。
【问题讨论】:
标签: python matplotlib