我正在使用matplotlib生成一些基于水平线的图,我很难绘制垂直线。
import numpy as np
import matplotlib as mpl
import matplotlib.dates as dates
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import pandas as pd
# this part is where I set my axes
plt.hlines("A",'2019-07-16T03:30','2019-07-16T17:30',"white","dotted")
plt.hlines("B",'2019-07-16T03:30','2019-07-16T17:30',"white","dotted")
plt.hlines("C",'2019-07-16T03:30','2019-07-16T17:30',"white","dotted")
# Time axis
# définition des heures (axe abcises) axe majeur
myFmt = mdates.DateFormatter('%H')
plt.gca().xaxis.set_major_formatter(myFmt)
plt.gca().xaxis.set_major_locator(mdates.HourLocator())
# after that i import my data and make some treatment
# then i browse each one and plot just a horizontal line with :
plt.hlines("A",date1,date2)
plt.hlines("B",date3,date4)
# here i want to plot the vertical lines between those 2 hlines
我希望制作一条垂直线,该垂直线从第一条水平线的末端开始,到第二条水平线的末端结束。