Python 从堆叠条形图中的x轴删除时间-按熊猫

Python 从堆叠条形图中的x轴删除时间-按熊猫,python,pandas,matplotlib,Python,Pandas,Matplotlib,我想从通过groupby生成的所有绘图中的x轴标记中删除时间(HH-MM-SS) MWE %matplotlib inline import pandas as pd import numpy as np index=pd.date_range('2011-1-1 00:00:00', '2011-11-30 23:50:00', freq='15min') df=pd.DataFrame(np.random.randn(len(index),2).cumsum(axis=0),column

我想从通过
groupby
生成的所有绘图中的x轴标记中删除时间(HH-MM-SS)

MWE

%matplotlib inline
import pandas as pd
import numpy as np


index=pd.date_range('2011-1-1 00:00:00', '2011-11-30 23:50:00', freq='15min')
df=pd.DataFrame(np.random.randn(len(index),2).cumsum(axis=0),columns=['A','B'],index=index)


df_hour = df.resample("H", how="mean")
df_day = df_hour.resample("D", how="sum")

results_group = df_day.groupby(lambda x: x.month)
results_group.plot(colormap='prism',kind='bar', stacked=True)
这就产生了:

我怎样才能只留下日期:YYYY-MM-DD或甚至MM-DD

我尝试过使用它,但出现了错误:
'Series'对象没有属性“set\xticklabels”

ax = results_group.plot(colormap='prism',kind='bar', stacked=True)
ax.set_xticklabels(df_day.index.format())

嗯。我得到了它。我把链接的例子搞砸了。以下是解决方案:

for key, group in results_group:
     ax = group.plot(colormap='prism',kind='bar', stacked=True)
     ax.set_xticklabels(df_day.index.format())