It would be nice if there was a "stacked" option for Series.plot like there is for DataFrame.plot.
Comment From: jorisvandenbossche
Can you give an example of how the result would look like? As for a dataframe, it are the different columns that are stacked or put next to each other (if not stacked). But when plotting a series, you only have one series of values to make a barplot for.
Comment From: cfblaeb
So a barplot from a Series is, as you describe, a bar for each value. So I would expected a stacked bar plot of a Series to simply stack those individual bars on top of each other.
Comment From: jorisvandenbossche
So to get a barplot with one bar?
You can always convert your series in a dataframe with one row, and then use stacked=True
, as in s.to_frame().T.plot(kind='bar', stacked=True)
Comment From: cfblaeb
Yes one, stacked, bar.
Comment From: jorisvandenbossche
I would personally say it is not needed to add this to the series plot method (somewhat inconsistent + easily done by converting to dataframe row).
@TomAugspurger @sinhrks other opinions?
Comment From: TomAugspurger
I'd also say that it's unnecessary
Comment From: sinhrks
Agreed it is not necessary. It sounds stacked=True
to have inconsistent behavior (stacking over columns for DataFrame, over rows for Series).
@fblaeb Pls reopen if we misunderstand, or you have an idea for better API.