app designer how to make zoom out for my plot ?
28 views (last 30 days)
Show older comments
I am using plot in my app designer ,how to make zoom out into my plot in the app designer ?
I found command for doing zoom in the plot of the plot of the appdesigner , how to do zoom out ?
1)is there a command ? becouse I tried zoom(app.UIAxes,'out') but I get error .
2) also in the matlab there is the command ytickes ( this command is giving me to the option to control y numbers of the y label ) , is there a similier command in the app designer ?
zoom(app.UIAxes,'on') %% zoom in the plot of matlab app designer
1 Comment
Answers (1)
Adam Danz
on 12 Dec 2019
Edited: Adam Danz
on 14 Jun 2023
Review of zoom methods in App Designer UIAxes
This topic continues to come up in the forum. The solution varies between Matlab releases.
Matlab release >= r2019a
Starting in r2019a, Control Chart Interactivity was enabled in App Designer. By default, when you hover over a UIAxes in App Designer you'll see a toolbar appear in the upper right of the axes.
The + and - icons will allow you to zoom in/out of the axes using your mouse. The hand icon will allow you to pan the axes. If this toolbar doesn't appear, it may have been turned off. To enable it, set the Visible property of the toolbar to 'on'.
app.UIAxes.Toolbar.Visible = 'on'; % or 'off' to disable
Matlab release r2017a - r2018b
Prior to r2019a, some interactive functionality was not supported. However, the pan and zoom utilities were available in App Designer starting in r2017a. When pan or zoom is set to 'on', you can use your mouse to interactively navigate the UIAxes.
Starting in MATLAB R2018b pan and zoom were enabled by default.
pan(app.UIAxes,'on'); % or 'off'
zoom(app.UIAxes,'on'); % or 'off'
Matlab release < r2017a
Prior to r2017a you cannot use the interactive chart tools nor the pan/zoom methods in app axes. A low-level way to zoom/pan an App Designer UIAxes is to control the axis limits using xlim(), ylim() and zlim(). You could add numeric text boxes to your app where the user can specify the axis limits or you could add arrow buttons that controll panning and zooming. The callback functions would adjust the axis limits as needed.
Another button could be added to return the axes to their default limits using these lines within the callback function.
app.UIAxes.XLimMode = 'auto';
app.UIAxes.YLimMode = 'auto';
app.UIAxes.ZLimMode = 'auto';
6 Comments
Svenja Jetzinger
on 27 May 2024
Edited: Svenja Jetzinger
on 27 May 2024
At the moment I'm using: imshow(maskedImage, 'parent', app.UIAxes2);
Are there any problems by using this code?
I changed your example into: image(app.UIAxes2, maskedImage). Now the zoom function is working, but the image is distorted. But at first, thank you for your idea!
I'm using Matlab R2022a.
Adam Danz
on 28 May 2024
Pan and zoom should be on by default in R2022a.
I tested it in 22a using
imshow(imread("peppers.png"),'parent',uiaxes(uifigure))
Try turning on default interactivity
enableDefaultInteractivity(app.UIAxes)
See Also
Categories
Find more on Interaction Control 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!