fig = plt.figure(figsize=(40,5))
ax1 = fig.add_subplot(111)
ax2 = ax1.twiny()
ax1.plot(time_stamps,b,"b.--",label="Status")
ax1.plot(time_stamps,d,"y.--",label="Process")
ax2.set_xlim(ax1.get_xlim())
ax1.set_xlim(ax2.get_xlim())
mymajorformat = mdates.DateFormatter('%H:%M')
myminorFormat = mdates.DateFormatter('%H:%M')
ax1.xaxis.set_major_locator
(MinuteLocator(byminute=range(0,60,5)))
ax2.xaxis.set_minor_locator
(MinuteLocator(byminute=range(0,60,60)))
ax2.tick_params(axis='x',which="minor",length=10,
rotation=30,labelsize=12)
ax1.tick_params(axis='x',which="major",length=10,
rotation=90,labelsize=11)
ax1.xaxis.set_major_formatter(mymajorformat)
ax2.xaxis.set_minor_formatter(myminorFormat)
ax2.set_xticks(ax1.get_xlim())
我不允许包含图像。正如你们所看到的,我有一个奇怪的x描述(红色框)在绘图的开始和结束,也在底部x轴的结尾。如何隐藏这个
这是有效的
ax2.set_xticks([])
相关问题 更多 >
编程相关推荐