How to preserve the 3d plot box, when changing patch visibility.
Show older comments
I have a 3d plot with a collection of patches. If I set a subset of patches Visible attributes to 'off', the plot box is recomputed. How can I capture and preserve all aspects of the plot box so that the visible patches don't jump around as other patches become visible or invisible.
Answers (2)
Using axis() twice, we can both capture and reassert the axis limits,
axis(axis)
This also then converts all X,Y,ZLimModes to 'manual' so automatic changes will not happen.
You don't need to capture anything.
To preserve the axes limits as they are, set the axes XLimMode, YLimMode, and ZLimMode to 'manual'. Obviously you would do that at a point in the code where the axes limits are what you want them to be, e.g., after all patches are initialized.
Other axes properties besides the limits affect the plot box, so you may want to set some other properties' modes to 'manual' as well in order to disable all undesired automatic changes to the plot box, e.g., PlotBoxAspectRatioMode, CameraViewAngleMode, etc. Look through the axes properties to see what you have control over:
3 Comments
John
40 minuten ago
Voss
ongeveer 9 uur ago
Interesting
Stephen23
ongeveer 4 uur ago
Report it as a bug with R2025x: https://www.mathworks.com/support/contact_us.html
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!