Zooming Into UIAxes Image Changes Axis Shape and Position: Why, and How Do I Fix?!
Show older comments
I am developing a MATLAB App, and have an image in a UIAxes, with the following properties defined:
s1 = 512;
s2 = 512;
app.UIAxes_Image_Plot.XLim = [0,s1];
app.UIAxes_Image_Plot.YLim = [0,s2];
app.UIAxes_Image_Plot.ZLim = app.UIAxes_Image_Plot.XLim;
app.UIAxes_Image_Plot.CameraPosition = [s1/2, s2/2, s1/2];
app.UIAxes_Image_Plot.CameraTarget = [s1/2, s2/2, 0];
daspect(app.UIAxes_Image_Plot, [1 1 1])
This plots the images well, and fill the whole defined axes position. However, when I attempt to zoom in with either a click or the scroll wheel, the image and axis both shrink and change position depending on where in the image I zoom in. I feel like the issue is due to the automatic updating of the CameraPosition and/or CameraTarget but I have played around with these settings, to no avail.
I also feel like I could update the data aspect ratio by the zoom factor i.e. zoom = 2 => DataAspectRatio = [2 2 2], however I don't know how I can get the zoom factor while scrolling/clicking zoom!
All I want is to be able to zoom into the image without the axis changing its shape or position within the figure window.
Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Camera Views 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!