sample code as below:
df = pd.DataFrame(dict(Subsidy=[3, 3, 3],
Bonus=[1, 1, 1],
Expense=[2, 2, 2],
Salary=[1, 2, 1],
Margin=[0.3,0.4,0.5]),
list('ABC'))
ax = df[['Subsidy', 'Bonus']].plot.bar(stacked=True, position=1,
width=.2, ylim=[0, 8], color=['orange', 'red'])
df['Margin'].plot(secondary_y=True, color='k', marker='o')
df[['Expense', 'Salary']].plot.bar(ax=ax,stacked=True, position=0,
width=.2, ylim=[0, 8], color=['blue', 'green'])
No comments:
Post a Comment