Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python matplotlib-检索xaxis_major_定位器作为时间值_Python_Matplotlib - Fatal编程技术网

python matplotlib-检索xaxis_major_定位器作为时间值

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点

我正在使用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点之间每天较暗的背景,并计划使用
axvspan
完成该任务。考虑到axvspan将axvspan作为参数
axvspan(xmin,xmax)

编辑:我在文档中找到了该功能:

如果有人知道如何从Xaxis_major返回股票代码位置列表,请告诉我。谢谢

编辑2:如果我使用打印(ax.xaxis.get\u major\u locator())我将收到一个返回值
如何从中提取勾号位置列表?

确定找到了它。。。 majors=ax.xaxis.get_majorticklocs()