-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
TST: fix some mpl warnings #38574
TST: fix some mpl warnings #38574
Conversation
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.
Please see the comment below.
I agree that addition of the tests is necessary.
pandas/plotting/_matplotlib/misc.py
Outdated
ax.set_xlim([-1, 1]) | ||
ax.set_ylim([-1, 1]) |
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 guess you can even use ax.set_xlim(-1, 1)
, without extra brackets.
The same for other cases as well.
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.
Done
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.
yeah pls add a tests that asssert_produces_warning(None) and fails on master but passes here
Will add tests once #38620 is figured out |
hmm |
It wasn't raising even when a warning was returned, with examples of this given in the issue. So there are currently no failures in master when wrapping these plotting calls with |
Wrapped existing calls that give warnings on master to avoid adding more plotting calls. If splitting out new tests for this is preferred instead, please let me know |
this looks good; ping on green |
Green |
thanks @mzeitlin11 |
@meeseeksdev backport 1.2.x |
Co-authored-by: mzeitlin11 <37011898+mzeitlin11@users.noreply.github.com>
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
This change fixes
UserWarning
being emitted in tests callingautocorrelation_plot
,andrews_curves
, andradviz
.UserWarning
was caused by callingplt.gca(xlim=..., ylim=...)
on a potentially already existing axis, somatplotlib
warns about this forcing new axis creation. Solution was just to explicitly useset_xlim
andset_ylim
instead.Does it make sense to also add to the relevant tests an assertion that no UserWarning is emitted to guarantee the new behavior?