Reputation: 51
I have been trying to create a stacked bar chart from simple data.
Assume the dictionary:
data ={A:2,B:3, C:4, D:5}
I would like to create a bar chart that shows like this:
I cant do it manually (i.e. dividing A by the total and so on) since I have a dictionary that consists of 20 keys.
I feel like it should be so simple but I can't figure it out
Thanks
Upvotes: 1
Views: 130
Reputation: 150725
You can try:
pd.Series(data).to_frame().T.plot.bar(stacked=True)
Output:
Upvotes: 1