Skip to content

[ENH] Implement dynamic clipping to axes limits for 3D plots#27349

Merged
QuLogic merged 4 commits intomatplotlib:mainfrom
scottshambaugh:3d_dynamic_masking
Oct 2, 2024
Merged

[ENH] Implement dynamic clipping to axes limits for 3D plots#27349
QuLogic merged 4 commits intomatplotlib:mainfrom
scottshambaugh:3d_dynamic_masking

Conversation

@scottshambaugh
Copy link
Copy Markdown
Contributor

@scottshambaugh scottshambaugh commented Nov 20, 2023

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_clip keyword argument (default False), which when True will 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):

3d_clip_to_axis_limits-1

Video of the dynamic behavior, please excuse my sluggish machine:

2023-11-25.22-47-45-1.mp4

PR checklist

@scottshambaugh scottshambaugh force-pushed the 3d_dynamic_masking branch 7 times, most recently from 74a0810 to 6bed144 Compare November 26, 2023 05:47
@scottshambaugh scottshambaugh marked this pull request as ready for review November 26, 2023 05:49
@scottshambaugh scottshambaugh mentioned this pull request Nov 26, 2023