Optimize 3D data limits calculation by simplifying direct updates to dataLim#28998
Optimize 3D data limits calculation by simplifying direct updates to dataLim#28998Thierno88 wants to merge 2 commits intomatplotlib:mainfrom Thierno88:main
Conversation
There was a problem hiding this comment.
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.
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.
|
@Thierno88 do you mean #28444 instead of #28403? |
timhoffm
left a comment
There was a problem hiding this comment.
This only proposes set_datalim_x/y/z() and corresponding properties datalim_x/y/z. I does not show how this is integerated with the current code, i.e. the auto limits, which #28444 is primarily about. I'm not convinced this new API is helping with that (or maybe I'm just not seeing it, because that part is not implemented here).
I'm also a bit sceptical to introduce z-information in the basic Artist. So far, the main matplotlib code is all 2D and 3D aspects are limited to mpl_toolkits.mplot3d.
This pull request addresses the inefficiency in updating 3D dataLim for plots in Matplotlib by eliminating unnecessary data processing and copying. Instead of creating a new _Bbox3d class, this PR introduces methods to directly compute and update the X, Y, and Z data limits using individual functions for each axis (get_datalim_x, get_datalim_y, get_datalim_z). This simplifies the code and improves performance by reducing the overhead of manipulating large data structures.
The change allows for direct updates of dataLim within the plotting logic, making the process of auto-scaling more efficient. This resolves the same core problem as discussed in issue #28403 but with a different approach, focusing on minimal code changes and improved performance.
PR Checklist:
closes FIX: Autoscale support in add_collection3d for Line3DCollection and Poly3DCollection #28403
New and changed code is tested to ensure accuracy and robustness.