Python 如何在matplotlib中将垂直线添加到条形图

Python 如何在matplotlib中将垂直线添加到条形图,python,pandas,matplotlib,Python,Pandas,Matplotlib,我有以下代码: ax = df30_pivoted.plot(kind='bar', figsize=(30,20), linewidth=5) plt.xticks(rotation='vertical') plt.tick_params(labelsize=20) plt.xlabel('session_date', fontsize=20) plt.grid(True) plt.title('', fontdict={'fontsize':60}) legend = ax.legend(l

我有以下代码:

ax = df30_pivoted.plot(kind='bar', figsize=(30,20), linewidth=5)
plt.xticks(rotation='vertical')
plt.tick_params(labelsize=20)
plt.xlabel('session_date', fontsize=20)
plt.grid(True)
plt.title('', fontdict={'fontsize':60})
legend = ax.legend(loc=0, ncol=1, bbox_to_anchor=(0,1,1), fancybox=True, shadow=False, title='variations', prop={'size':45})


xposition = c12
for xc in xposition:
    ax.axvline(x=xc, color='r', linewidth=4)
plt.setp(legend.get_title(), fontsize='30')

plt.show()
我期望上面的代码放置垂直线,其中x轴上的索引与我在c12中的索引相同,c12是类型为
datetime64[ns]
的熊猫系列,但结果条形图没有垂直线:


什么是
c12
?如果您需要帮助,您需要提供帮助。您可以迭代c12吗?您的绘图不显示垂直线吗?什么是
c12
?如果你需要帮助,你需要提供一个例子。你能迭代c12吗?你的图不是显示垂直线吗?