FIX: prevent log-scale warning in _AxesBase._clear for log scales#31403
FIX: prevent log-scale warning in _AxesBase._clear for log scales#31403marcchahwan wants to merge 1 commit intomatplotlib:mainfrom
Conversation
|
Thank you for opening your first PR into Matplotlib! If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process. You can also join us on gitter for real-time discussion. For details on testing, writing docs, and our review process, please see the developer guide. We strive to be a welcoming and open project. Please follow our Code of Conduct. |
|
Hi @marcchahwan please have a look at your PR summary. I think you wrote more than is actually showing up. |
PR summary
import matplotlib.pyplot as pltSetup a figure with a logarithmic scale
fig, ax = plt.subplots()
ax.set_xscale('log')
In current main, calling clear() (or cla()/clf()) triggers:
UserWarning: Attempted to set non-positive xlimits on stderr.
With this PR, the warning is eliminated as limits are set to (nonpos, 1).
ax.clear()
plt.show()
AI Disclosure
I utilized Gemini to assist in the verification and testing phase of this PR. It also assisted in the design of a minimal reproduction script to verify that the Userwarning was successfully eliminated and ensured the implementation adhered to Matplotlib’s internal standards for handling non-linear scales.PR checklist