I know how to create a stacked bar chart using a dataframe with multiple rows, but is there a way to plot a series such that each index in the series in put into a stacked bar plot?
What I get is something like this:
Code:
series = pd.Series(3 * np.random.rand(4), index=['a', 'b', 'c', 'd'], name='series')
series.plot(kind = 'bar')
But what I want is to show a,b,c, and d all in one stacked bar graph. Can somebody help?
Not sure what you want since you haven't specified the desired output, but here is a try
pd.DataFrame(series).T.plot.bar(stacked=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With