Skip to content

Commit 3567ac9

Browse files
charlesdong1991rhshadrach
authored andcommitted
DOC/PLT: Add stacked in doc and doc example for barh and bar plot (pandas-dev#33337)
1 parent 66c84fd commit 3567ac9

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
@@ -1015,6 +1015,13 @@ def line(self, x=None, y=None, **kwargs):
10151015
... 'lifespan': lifespan}, index=index)
10161016
>>> ax = df.plot.bar(rot=0)
10171017
1018+
Plot stacked bar charts for the DataFrame
1019+
1020+
.. plot::
1021+
:context: close-figs
1022+
1023+
>>> ax = df.plot.bar(stacked=True)
1024+
10181025
Instead of nesting, the figure can be split by column with
10191026
``subplots=True``. In this case, a :class:`numpy.ndarray` of
10201027
:class:`matplotlib.axes.Axes` are returned.
@@ -1096,6 +1103,13 @@ def bar(self, x=None, y=None, **kwargs):
10961103
... 'lifespan': lifespan}, index=index)
10971104
>>> ax = df.plot.barh()
10981105
1106+
Plot stacked barh charts for the DataFrame
1107+
1108+
.. plot::
1109+
:context: close-figs
1110+
1111+
>>> ax = df.plot.barh(stacked=True)
1112+
10991113
We can specify colors for each column
11001114
11011115
.. plot::

0 commit comments

Comments
 (0)