Skip to content

Commit 6e680ff

Browse files
DOC/PLT: Add stacked in doc and doc example for barh and bar plot (#33337)
1 parent 9c36c83 commit 6e680ff

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pandas/plotting/_core.py

+14
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,13 @@ def line(self, x=None, y=None, **kwargs):
10071007
... 'lifespan': lifespan}, index=index)
10081008
>>> ax = df.plot.bar(rot=0)
10091009
1010+
Plot stacked bar charts for the DataFrame
1011+
1012+
.. plot::
1013+
:context: close-figs
1014+
1015+
>>> ax = df.plot.bar(stacked=True)
1016+
10101017
Instead of nesting, the figure can be split by column with
10111018
``subplots=True``. In this case, a :class:`numpy.ndarray` of
10121019
:class:`matplotlib.axes.Axes` are returned.
@@ -1088,6 +1095,13 @@ def bar(self, x=None, y=None, **kwargs):
10881095
... 'lifespan': lifespan}, index=index)
10891096
>>> ax = df.plot.barh()
10901097
1098+
Plot stacked barh charts for the DataFrame
1099+
1100+
.. plot::
1101+
:context: close-figs
1102+
1103+
>>> ax = df.plot.barh(stacked=True)
1104+
10911105
We can specify colors for each column
10921106
10931107
.. plot::

0 commit comments

Comments
 (0)