-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Add the ability to have a separate title for each subplot when plotting #14753
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
jorisvandenbossche
merged 15 commits into
pandas-dev:master
from
icanhazcodeplz-zz:plotting
Dec 9, 2016
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3f133ac
Add logic such that if 'title' is a list and 'subplots' is True, use …
icanhazcodeplz-zz 55f4667
ENH: Add the ability to have a separate title for each subplot when p…
icanhazcodeplz-zz 8d1b598
Merge branch 'master' into plotting
icanhazcodeplz-zz ecb9453
switch to using 'is_list_like'
icanhazcodeplz-zz d6d1b0c
add line describing the new titles for subplots feature
icanhazcodeplz-zz 94ea2d3
add tests to check if the titles above subplots are correct if 'subpl…
icanhazcodeplz-zz eb43f25
-raise ValueError if len(title) != number of columns.
icanhazcodeplz-zz 5586a96
added :issue:`14753`
icanhazcodeplz-zz aa5bb98
-use self.nseries instead of len(self.axes)
icanhazcodeplz-zz 2059339
-use self.nseries instead of len(self.axes)
icanhazcodeplz-zz 7a293ef
Merge remote-tracking branch 'upstream/master' into plotting
icanhazcodeplz-zz 301cc7d
use .get_title() instead of .title._text
icanhazcodeplz-zz 5b88951
-Add 'Title to use for the plot' as the first sentence for the docstr…
icanhazcodeplz-zz c206daf
Merge remote-tracking branch 'upstream/master' into plotting
icanhazcodeplz-zz 59ab880
Fix 'continuation line under-indented for visual indent' found by lin…
icanhazcodeplz-zz 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 |
---|---|---|
|
@@ -1217,7 +1217,11 @@ def _adorn_subplots(self): | |
|
||
if self.title: | ||
if self.subplots: | ||
self.fig.suptitle(self.title) | ||
if type(self.title) == list: | ||
for (ax, title) in zip(self.axes, self.title): | ||
ax.set_title(title) | ||
else: | ||
self.fig.suptitle(self.title) | ||
else: | ||
self.axes[0].set_title(self.title) | ||
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 raise if |
||
|
||
|
@@ -2555,8 +2559,12 @@ def _plot(data, x=None, y=None, subplots=False, | |
figsize : a tuple (width, height) in inches | ||
use_index : boolean, default True | ||
Use index as ticks for x axis | ||
title : string | ||
Title to use for the plot | ||
title : string or list | ||
If a string is passed, print the string at the top of the figure. If a | ||
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. Can you leave the starting sentence "Title to use for the plot" ? |
||
list of strings is passed and subplots is True, print the the first | ||
string above the first subplot, the second string above the second | ||
subplot, and so forth until the end of the list is reached or there are | ||
no more subplots. | ||
grid : boolean, default None (matlab style default) | ||
Axis grid lines | ||
legend : False/True/'reverse' | ||
|
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.
pls use
is_list_like
, and check the input length are correct. Note that all the axes may not require title when you specifylayout
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.
Ok I'll use
is_list_like
. I purposely did not check the lengths as a feature. As it's written, if you only provide a list of two strings, but the plot has 3 suplots, the first two subplots will have a title and the third will be left without one.