[ENH] Implement dynamic clipping to axes limits for 3D plots#27349
Merged
QuLogic merged 4 commits intomatplotlib:mainfrom Oct 2, 2024
Merged
[ENH] Implement dynamic clipping to axes limits for 3D plots#27349QuLogic merged 4 commits intomatplotlib:mainfrom
QuLogic merged 4 commits intomatplotlib:mainfrom
Conversation
74a0810 to
6bed144
Compare
Closes #25804
PR summary
This PR introduces "dynamic clipping" of the data in 3D plots, such that data outside the axis limits is not shown. I did a deep dive into stackoverflow and found 12 separate questions asking for this sort of functionality (see that list in this comment).
All 3D plotting functions now support the
axlim_clipkeyword argument (defaultFalse), which whenTruewill clip the data to the axes view limits, hiding all data outside those bounds. This clipping will be dynamically applied in real time while panning and zooming.Please note that if one vertex of a line segment or 3D patch is clipped, the entire segment or patch will be hidden. Not being able to show partial lines or patches such that they are "smoothly" cut off at the boundaries of the view box is a limitation of the current renderer.
What's new and new gallery example image (I'm not in love with this example, but it'll do for now):
Video of the dynamic behavior, please excuse my sluggish machine:
2023-11-25.22-47-45-1.mp4
PR checklist