-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[ENH] Implement dynamic clipping to axes limits for 3D plots #27349
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
74a0810
to
6bed144
Compare
490ad58
to
b73d8dc
Compare
674235d
to
faf74b6
Compare
TODO:
|
faf74b6
to
7b9bb21
Compare
b2a9978
to
be117e7
Compare
857252a
to
8931e3a
Compare
I don't think that's the case; we can definitely clip partial lines or patches to the Axes. Unless you mean the 3D renderer? In that case, you would have to do some magic to calculate the clipping path of the Axes3D box with the artist in flattened 2D space, and apply it with |
bcb8a41
to
7506e37
Compare
Thank you for the review @QuLogic! I believe all your comments are addressed now |
The docs build error is unrelated:
|
7506e37
to
c52b9a0
Compare
I think that the docs error isn't actually generic, will investigate. |
The missing reference handler is now a bit more specific about these things, so if you've added/removed some lines in a docstring, you may have to update the line numbers in the json file to get it to skip again. |
This is a rather confusing error. It traces back to matplotlib/doc/missing-references.json Lines 301 to 329 in b01462c
... but I did add 3 lines to the
|
It's not complaining about Also, I just noticed this looking at other arguments, but |
@QuLogic I'm not seeing this error on local docs builds. Do you know of another way to track it down? |
Make axlim_clip flag keyword only Updates test image test image restore
d1c41de
to
ee9f0a9
Compare
70c8344
to
439841a
Compare
Implement dynamic clipping to axes box for 3D plots Make axlim_clip flag keyword only Updates test image test image restore Implement dynamic clipping to axes box for 3D plots Make axlim_clip flag keyword only Updates test image test image restore Implement dynamic clipping to axes box for 3D plots Make axlim_clip flag keyword only Updates test image test image restore Code review comments on 3D axlim clipping Code review comments on 3D axlim clipping
439841a
to
cc5e8d5
Compare
Ok, fixed the issue with The remaining docs error is an instance of #28744 and is unrelated. @QuLogic I also added in |
Thank you for addressing this issue! Which version of matplotlib will incorporate the fix? My current version is 3.9.2. |
Hi @nbfazel, this will be out in the future 3.10 release. |
Thank you! |
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 (defaultFalse
), which whenTrue
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):
Video of the dynamic behavior, please excuse my sluggish machine:
2023-11-25.22-47-45-1.mp4
PR checklist