Not able to create plot with multi-index DataFrame

In this dataframe, there are multi index, I am unable to create plot with that. I am using
I want to create a plot such that for each type, there is a stacked bar plot of female and male. Any help?


ok so after unstacking it does create a plot using df.plot(kind = ‘bar’), but I want to create a plot, it doesn’t accepts multi index columns.

ok so this worked –

fig = plt.gcf();
fig.set_size_inches(15, 6);, df3.Female, color = 'pink'), df3.Male, bottom = df3.Female, color = 'blue')
plt.xticks(rotation = 90)

But if any other suggestion regarding this, pls let me know.

1 Like

For this code

df.plot(kind = 'bar')

The figure size attributes aren’t working.

fig = plt.gcf();


df.unstack().plot(kind = 'bar');



I tried the above code, but figure size is small only, for other plot types like, this works.