我想要的非常简单,我只是希望定位器刻度从指定的时间戳开始:
到目前为止,我还没有找到任何东西。
这是与此问题相关的代码部分:
伪代码:locator.set_start_ticking_at( datetime_dummy )
到目前为止,我还没有找到任何东西。
这是与此问题相关的代码部分:
axes[0].set_xlim(datetime_dummy) # datetime_dummy = '2015-12-25 05:34:00'
import matplotlib.dates as matdates
seclocator = matdates.SecondLocator(interval=20)
minlocator = matdates.MinuteLocator(interval=1)
hourlocator = matdates.HourLocator(interval=12)
seclocator.MAXTICKS = 40000
minlocator.MAXTICKS = 40000
hourlocator.MAXTICKS = 40000
majorFmt = matdates.DateFormatter('%Y-%m-%d, %H:%M:%S')
minorFmt = matdates.DateFormatter('%H:%M:%S')
axes[0].xaxis.set_major_locator(minlocator)
axes[0].xaxis.set_major_formatter(majorFmt)
plt.setp(axes[0].xaxis.get_majorticklabels(), rotation=90 )
axes[0].xaxis.set_minor_locator(seclocator)
axes[0].xaxis.set_minor_formatter(minorFmt)
plt.setp(axes[0].xaxis.get_minorticklabels(), rotation=90 )
# other codes
# save fig as a picture
上述代码的x轴刻度将会得到:
我该如何告诉次要定位器与主要定位器对齐?
我该如何告诉定位器从哪个时间戳开始计时?
我尝试过的方法:
set_xlim
无效
seclocator.tick_values(datetime_dummy, datetime_dummy1)
没有任何作用
bysecond=list
是如何工作的?我认为我在阅读文档时忽略了这个参数,因为我不理解它的作用。谢谢。 - eliu