I have a nested dict
that looks like this:
mydict = {
'A': {'apples': 3, 'bananas': 5, 'kiwis': 9, 'oranges': 6},
'B': {'apples': 1, 'bananas': 9, 'kiwis': 1, 'oranges': 3},
'C': {'apples': 6, 'bananas': 9, 'kiwis': 3, 'oranges': 3},
}
A,B,C are the group labels. Apples, bananas, kiwis, and oranges are counts within each group. I'd like to plot a grouped vertical bar chart using matplotlib
. It would have a legend with three colors for apples, bananas and oranges.
I am only able to plot using DataFrame.plot method:
pd.DataFrame(mydict).T.plot(kind='bar')
I want to be able to plot the same using matplotlib
, so I can manage figure size, and change the size of the bars etc.