Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Refactor for issue 28444#30115
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?
Refactor for issue 28444#30115
Conversation
The values are most likely observations of what the current algorithm gives. However, looking at the last failure, the updated method determines the limits -0.02, 1.02, while the old version was -0.08, 4.0833 (basically 0, 1 now, earlier 0, 4, but with some margins). Looking at the input data for the last test, there are z-values that are 4, so in that case it seems like the new approach is not working. (Now that I understand it a bit more, in the first test it has changed from 0, 2 to 0, 1. But one line has an x-value of 2, so, again, the new approach seems to be off. While probably not the case, it seems like the new approach is always return 0, 1, at least based on the working and failing tests, although the code seems to make sense from a quick check.) |
This reverts commit7b8c5e1.
PR summary
This PR adressesissue #28444 and introduces a new internal 3D bounding box system to improve the way data limits are computed for 3D artists in mpl_toolkits.mplot3d.
Why is this change necessary?
Currently, autoscaling for 3D plots requires extracting and copying x, y, and z data from each artist, which is inefficient and error-prone. The system relies on auto_scale_xyz(), which is tied to manual data unpacking.
What’s implemented:
Added _Bbox3d, a 3D bounding box class with conversion methods to 2D Bbox
Added _get_datalim3d() to several 3D artist types: Line3D, Line3DCollection, Poly3DCollection, Patch3D, etc.
Implemented Axes3D.auto_scale_lim(bbox3d) using Bbox.union()
Updated add_collection3d() to use _get_datalim3d() and auto_scale_lim()
This lays the groundwork for a full refactor and replacement of auto_scale_xyz() across the codebase.
Let me know if it is workin as intended