Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Do not add padding to 3D axis limits when limits are manually set#25272
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
oscargus commentedFeb 21, 2023
Although I think that this is really how it should be, the question is if we can just enforce it or if there should be a deprecation path? Better ping in@timhoffm directly... |
56f5c0e toeb13ba8Comparescottshambaugh commentedFeb 21, 2023
This is changing intended behavior in some of the tests so some tweaking to do, but should be enough here right now to get an idea. |
scottshambaugh commentedFeb 24, 2023
Talked about this in the dev call today, consensus was to make the new behavior default without deprecation, but add an rc_param to switch back to current behavior. |
ba17fca to164a811Compare164a811 to9ed0c5bCompare3200e54 to2239207Comparescottshambaugh commentedApr 30, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
40fc8f0 to1c04693Comparescottshambaugh commentedApr 30, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Well, it looks like the floating point theory is likely correct, because the tests are all passing on my machine, and the different CI platforms are having different tests throw image comparison errors. What's the proper way to handle this? Loosen the image comparison tolerance? I'm not sure how to examine the test images from the different CI environments if I can't recreate the issue locally. |
00f03ca to43f7d59Compareoscargus commentedApr 30, 2023
The ideal way is to add platform-specific margins, like: matplotlib/lib/matplotlib/tests/test_lines.py Lines 187 to 189 ine7fd79f
I think one way to make it at least slightly better is to pre-compute the constants. In this way one error source is removed and the code will execute slightly faster. Always possible to use a comment to illustrate where it comes from. |
oscargus 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.
Most of the constants should be pre-computed I think.
Doc-strings should typically have a single-sentence/line description (hence, the need for an empty line after).
A change note is required for the new rcParam
I think the purpose of the PR is for sure worthwhile, but I do not know enough to have any real comments on the implentation.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
b55d12c to978889bComparescottshambaugh commentedApr 30, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thank you for the thorough review@oscargus! To give some context for where these constants are coming from, the original behavior when generating the view limits for 3d plots was fairly broken. There was always 1/48 of the axis range added to either side of the axis bounds when drawing the axes, however this extra "view margin" was purely visual. The calculations for the zoom level for the plot, which grid/tick lines to show, and several other spots in the code all used the non-padded axis limits for their calculation. So, when I converted the backed to use the actual axis limits everywhere, this required putting in a lot of scale factors to keep the visual appearance ( |
978889b to415763eComparetacaswell commentedAug 2, 2023
QuLogic commentedAug 2, 2023
OK, can we mention that in the comments? It currently says something like "to match mpl3.7 appearance", so it can say "to match mpl3.7 appearance that added 1/48 padding". Also feel free to put a longer explanation in the commit message. |
6b38c5e todfdc014Comparefe42617 to24254deComparescottshambaugh commentedAug 3, 2023
Thanks! Rebased/squashed, and added a lot more detail to the comments on scale factors.@QuLogic do those address your concerns? |
Fix remaining large image diffsFix remaining large image diffsFix the rest of the testsFix docs errorCode review updatesCode review updatesFix docs errorOne more constantTweaksKeep fixing CI errorsDocstringsUpdate baseline imagesMore test imagesImagesTest new scaling factorTest new scaling factorTest for exact limitsCleanupTestsUpdate doc/users/next_whats_new/3d_axis_limits.rstCo-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>rebase fixesApply suggestions from code reviewCo-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>Code review cleanupMerge conflicts and better commentsMerge conflicts and better comments
24254de tof1141d1Comparef60f5a0 to0da1b6cComparescottshambaugh commentedSep 17, 2023
Bump on merging this now that 3.8.0 is out |
timhoffm commentedSep 18, 2023
@scottshambaugh Thanks! |
ksunden commentedSep 18, 2023
Unclear to me why this didn't happen for this PR, but references to It looks like the warning is that it can't find themat all, rather than that it e.g. sees both Sphinx version is different (7.2.4 here, 7.2.6 on main), though only as patch releases, and nothing obviously related in release notes.
|
Attempt to fix doc build failure introduced withmatplotlib#25272.I suspect this is sphinx scoping:matplotlib#25272 reused methodslike `Axes.set_xbounds` to generate documentation for Axes3D. However,a see also of invert_xaxis only searches within the same module (orclass), and invert_xaxis is not documented for Axes3D. This PR broadensthe search scope by using the leading dot. An alternative may be toattempt to explicitly document the missing methods for Axes3D.
Attempt to fix doc build failure introduced withmatplotlib#25272.I suspect this is sphinx scoping:matplotlib#25272 reused methodslike `Axes.set_xbounds` to generate documentation for Axes3D. However,a see also of invert_xaxis only searches within the same module (orclass), and invert_xaxis is not documented for Axes3D. This PRattempt to explicitly document the missing methods for Axes3D.


Uh oh!
There was an error while loading.Please reload this page.
PR Summary
Closes#18052
Before:

After (exact limits for x and y, z retains default padded limits):

There are a ton of test image changes, gonna be a hefty commit.PR Checklist
Documentation and Tests
pytestpasses)Release Notes
.. versionadded::directive in the docstring and documented indoc/users/next_whats_new/.. versionchanged::directive in the docstring and documented indoc/api/next_api_changes/next_whats_new/README.rstornext_api_changes/README.rst