-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC/PLT: Add stacked
in doc and doc example for barh and bar plot
#33337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
7e461a1
1314059
8bcb313
24c3ede
dea38f2
cd9e7ac
e5e912b
045a76f
f3513b0
aced183
ae796b6
11d7644
d1c5a3f
8d462f9
ef32ea2
0ba8e2f
ee3599a
15b4319
f01036b
c5c6bbe
cd076af
dfd7b5d
c18fc21
629d639
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -954,6 +954,9 @@ def line(self, x=None, y=None, **kwargs): | |||||
|
||||||
@Appender( | ||||||
""" | ||||||
stacked: bool, default is False | ||||||
If stacked is set to True, stacked bar charts will be plotted. | ||||||
|
||||||
See Also | ||||||
-------- | ||||||
DataFrame.plot.barh : Horizontal bar plot. | ||||||
|
@@ -985,6 +988,13 @@ def line(self, x=None, y=None, **kwargs): | |||||
... 'lifespan': lifespan}, index=index) | ||||||
>>> ax = df.plot.bar(rot=0) | ||||||
|
||||||
Plot stacked bar chars for the DataFrame | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be ‘bar charts’? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops! 😅 Nice catch! |
||||||
|
||||||
.. plot:: | ||||||
:context: close-figs | ||||||
|
||||||
>>> ax = df.plot.bar(stacked=True) | ||||||
|
||||||
Instead of nesting, the figure can be split by column with | ||||||
``subplots=True``. In this case, a :class:`numpy.ndarray` of | ||||||
:class:`matplotlib.axes.Axes` are returned. | ||||||
|
@@ -1037,6 +1047,9 @@ def bar(self, x=None, y=None, **kwargs): | |||||
|
||||||
@Appender( | ||||||
""" | ||||||
stacked: bool, default is False | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks! |
||||||
If stacked is set to True, stacked horizontal bar charts will be plotted. | ||||||
|
||||||
See Also | ||||||
-------- | ||||||
DataFrame.plot.bar: Vertical bar plot. | ||||||
|
@@ -1066,6 +1079,13 @@ def bar(self, x=None, y=None, **kwargs): | |||||
... 'lifespan': lifespan}, index=index) | ||||||
>>> ax = df.plot.barh() | ||||||
|
||||||
Plot stacked bar chars for the DataFrame | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks! |
||||||
|
||||||
.. plot:: | ||||||
:context: close-figs | ||||||
|
||||||
>>> ax = df.plot.bar(stacked=True) | ||||||
|
||||||
We can specify colors for each column | ||||||
|
||||||
.. plot:: | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!