我仍然獲得在xticks漂亮圓潤DATATIME工作: rounding datetimes in xticks matplotlibmdates.DateLocator()提高NotImplemented錯誤
所以答案是罰款,我可以用
plt.gca().xaxis.set_major_locator(mdates.HourLocator())
得到全面小時在xticks中。
但是,如果我簡單地做
plt.gca().xaxis.set_major_locator(mdates.DateLocator())
它給:
File "/python/anaconda-2.7.11-64/lib/python2.7/site-packages /matplotlib/ticker.py", line 1289, in __call__
raise NotImplementedError('Derived must override')
NotImplementedError: Derived must override
難道真的不可能改變HourLocator()來DateLocator()? 我正在使用 matplotlib.__version__'2.0.2'
也許嘗試'AutoDateLocator'?或者如果你知道你想要幾個月或幾年,試試'MonthLocator'或'YearLocator'? – tom