python matplotlib-检索xaxis_major_定位器作为时间值
我正在使用matplotlib绘制timeserie(timeserie如下所示): 我使用的部分代码设置了每天早上0点的主要定位器:python matplotlib-检索xaxis_major_定位器作为时间值,python,matplotlib,Python,Matplotlib,我正在使用matplotlib绘制timeserie(timeserie如下所示): 我使用的部分代码设置了每天早上0点的主要定位器: fig, ax = plt.subplots(figsize=(20, 3)) mpf.candlestick_ohlc(ax,quotes, width=0.01) ax.xaxis_date() ax.xaxis.set_major_locator(mpl.dates.DayLocator(interval=1) ) 我想在图表上绘制下午16点到上午8点
fig, ax = plt.subplots(figsize=(20, 3))
mpf.candlestick_ohlc(ax,quotes, width=0.01)
ax.xaxis_date()
ax.xaxis.set_major_locator(mpl.dates.DayLocator(interval=1) )
我想在图表上绘制下午16点到上午8点之间每天较暗的背景,并计划使用axvspan
完成该任务。考虑到axvspan将axvspan作为参数axvspan(xmin,xmax)
编辑:我在文档中找到了该功能:
如果有人知道如何从Xaxis_major返回股票代码位置列表,请告诉我。谢谢
编辑2:如果我使用打印(ax.xaxis.get\u major\u locator())我将收到一个返回值
如何从中提取勾号位置列表?确定找到了它。。。
majors=ax.xaxis.get_majorticklocs()