-
-
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
Merged
datapythonista
merged 24 commits into
pandas-dev:master
from
charlesdong1991:add_stacked_doc
May 6, 2020
Merged
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
7e461a1
remove \n from docstring
charlesdong1991 1314059
fix conflicts
charlesdong1991 8bcb313
Merge remote-tracking branch 'upstream/master'
charlesdong1991 24c3ede
Merge remote-tracking branch 'upstream/master'
charlesdong1991 dea38f2
fix issue 17038
charlesdong1991 cd9e7ac
revert change
charlesdong1991 e5e912b
revert change
charlesdong1991 045a76f
Merge remote-tracking branch 'upstream/master'
charlesdong1991 f3513b0
Add stacked in doc for bar/h
charlesdong1991 aced183
fixup
charlesdong1991 ae796b6
fix pep8
charlesdong1991 11d7644
better example
charlesdong1991 d1c5a3f
fix linting
charlesdong1991 8d462f9
spaces
charlesdong1991 ef32ea2
Merge remote-tracking branch 'upstream/master' into add_stacked_doc
charlesdong1991 0ba8e2f
fix typo
charlesdong1991 ee3599a
Merge remote-tracking branch 'upstream/master' into add_stacked_doc
charlesdong1991 15b4319
fix typo
charlesdong1991 f01036b
Merge remote-tracking branch 'upstream/master' into add_stacked_doc
charlesdong1991 c5c6bbe
Merge remote-tracking branch 'upstream/master' into add_stacked_doc
charlesdong1991 cd076af
Merge remote-tracking branch 'upstream/master' into add_stacked_doc
charlesdong1991 dfd7b5d
Merge remote-tracking branch 'upstream/master' into add_stacked_doc
charlesdong1991 c18fc21
remove doc
charlesdong1991 629d639
Merge remote-tracking branch 'upstream/master' into add_stacked_doc
charlesdong1991 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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 | ||
|
||
.. 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 False | ||
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:: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should this be ‘bar charts’?
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.
Oops! 😅 Nice catch!