Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Fix axis3d to include offset text in tight bounding box calculation#30760
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Fix axis3d to include offset text in tight bounding box calculation#30760
Conversation
The previous test used an overly strict tolerance (rtol=1e-10) which couldfail due to floating-point precision differences across platforms andbackends. Simplified the test to directly check that the tight bboxcontains the offset text bbox with a reasonable tolerance (1e-6).
The test now only checks that offset_text is included in the tightbbox when it's actually visible and has content. This handles caseswhere different backends or configurations may not show offset text.Added helpful error messages to aid debugging if assertions fail.
27505a1 to1adbbc8CompareMatch the pattern used for label (line 716) by checking that offsetTexthas actual content before including it in the bounding box calculation.This prevents including empty offset text in the bbox.
d606497 to9335670CompareExplicitly close the figure after the test completes to ensureproper cleanup and avoid potential interference with other tests.
Remove explicit plt.close(fig) call as matplotlib's test frameworkhandles cleanup automatically. The explicit close was causing testfailures across multiple platforms.
FazeelUsmani commentedNov 19, 2025
This PR fixes issue#30744 by including Implementation Complete CI Status: Is this a known flaky test on ARM runners? Should I:
The core fix is complete and tested. Let me know if any changes are needed! |
rcomer commentedNov 19, 2025
Hi@FazeelUsmani the webagg test is indeed known to be flaky so you can ignore it. |
FazeelUsmani commentedNov 19, 2025
Thanks@rcomer for confirming! The PR is ready for review. |
scottshambaugh left a comment
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.
This looks good for me, thanks for putting it together!
Good candidate for a squash merge
#30744
The fix follows the same pattern used in the 2D axis implementation (
lib/matplotlib/axis.py:1366-1369), which includesoffsetTextin the bounding box calculation by:offsetTextis visibleThe implementation adds these two lines to
axis3d.py:This ensures consistency between 2D and 3D axis behavior.
Minimum self-contained example
PR checklist