Python中的聚集堆叠条

Python中的聚集堆叠条,python,pandas,matplotlib,Python,Pandas,Matplotlib,我已经创建了一个单一的堆叠条形图,但我想把它们聚集起来。和这幅画一模一样 想知道这是否可能 嗨,如果我想用date作为列表的名称呢? df = pd.DataFrame(dict(Subsidy=[3, 3, 3], Bonus=[1, 1, 1], Expense=[2, 2, 2]), list('ABC')) df ax = df[['Subsidy', 'B

我已经创建了一个单一的堆叠条形图,但我想把它们聚集起来。和这幅画一模一样

想知道这是否可能


嗨,如果我想用date作为列表的名称呢?
df = pd.DataFrame(dict(Subsidy=[3, 3, 3],
                       Bonus=[1, 1, 1],
                       Expense=[2, 2, 2]),
                  list('ABC'))

df
ax = df[['Subsidy', 'Bonus']].plot.bar(stacked=True, position=1,
                            width=.2, ylim=[0, 8], color=['orange', 'red'])
df[['Expense']].plot.bar(ax=ax, position=0, width=.2, color=['green'])