-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: fix warnings on multiple subplots #37274
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
jreback
merged 6 commits into
pandas-dev:master
from
ivanovmg:warnings/matplotlib-subplots
Nov 9, 2020
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0ac41d1
TST: fix warnings on multiple subplots
ivanovmg bdb7001
Merge branch 'master' into warnings/matplotlib-subplots
ivanovmg 66a5923
REF: rename to _check_plot_default_axes_works
ivanovmg 8ab2bfd
Merge branch 'master' into warnings/matplotlib-subplots
ivanovmg ee1d941
REF: refactor using default_axes kwarg
ivanovmg d33322e
DOC: add docstring to _check_plot_works
ivanovmg 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
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
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.
emm, will
_check_single_plot_works
not raise warning here? seems the purpose of having_check_single_plot_works
is to avoid creating subplots inside function?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.
Right,
_check_single_plot_works
does not raise the warning concerned, regarding figure being cleared.In my opinion the need for
_check_single_plot_works
(or whatever the better name would be) is when the plotting method (likeDataFrame.hist
) creates subplots itself (may depend on the the options provided to the method).The warning gets raised when the plotting method creates enough subplots required on its own, but we forcefully add subplots in
_check_plot_works
.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.
emm, okay. for
DataFrame.hist
, i think as long as it plots data from multiple columns, or aby
is used, then will have subplots.my main concern is in
pandas.plot
API where the implementation is different, and there is an argument calledsubplots
, then do we also need to use_check_single_plot_works
(or probably other name is better) whensubplots=True
for those test cases?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.
Instead of putting in-line comments under
_check_plot_works
function, maybe it's nicer to put few words about usecase/guideline of when to suggest to use which so that could help future contributors select the right function? how does this sound?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.
I actually thought of not using comments here and instead call
_check_single_plot_works
. This way there will be no warning raised.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.
Right, is
subplots=True
, then it seems that we need to use_check_single_plot_works
.But I really don't like the name of this function )
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.
yes, #37274 (comment) actually I was here wondering why not use
_check_single_plot_works
to remove warningsorry for my confusing comment, i meant to have one sentence to tell future users when to use
_check_single_plot_works
and when to use_check_plot_works
in testing, something likeUsing _check_single_plot_works when plotting methods generate a subplot itself, if not, use _check_plot_works
will be enough IMHO.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.
indeed, maybe
_check_plot_with_subplots_works
? or something more straightforward/explicit?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.
What about
_check_plot_default_axes_works
?I replaced catching warning with the use of the new function as well.
@charlesdong1991
I do not like
_check_plot_with_subplots_works
either because it is not clear what the word subplots means here.In fact original
_check_plot_works
creates subplots, so one can easily mix-up the meaning of the subplots term.