app designer how to make zoom out for my plot ?

64 views (last 30 days)
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
Adam Danz
Adam Danz on 12 Dec 2019
Edited: Adam Danz on 16 Dec 2019
Zooming in and out can be controlled by your mouse. What command are you using to zoom in and what is your Matlab release number?
Regarding ytick, you can set them directly from your axis handle.

Sign in to comment.

Answers (1)

Adam Danz
Adam Danz on 12 Dec 2019
Edited: Adam Danz on 18 Jan 2020
Here's a review of zoom methods in App Designer UIAxes (current relase: r2019b).
This topic continues to come up in the forum and 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, interactive charts were not supported. However, the pan and zoom utilities were enabled in App Designer starting in r2017a. You could add a button that toggles on/off the pan unility and one that toggles on/off the zoom utility. When pan or zoom is set to 'on', you can use your mouse to interactively navigate the UIAxes.
pan(app.UIAxes,'on'); % or 'off'
zoom(app.UIAxes,'on'); % or 'off'
When the untilities are turned off, the default axis limits can be returned by using these lines of code:
app.UIAxes.XLimMode = 'auto';
app.UIAxes.YLimMode = 'auto';
app.UIAxes.ZLimMode = 'auto';
Matlab release < r2017a
Prior to r2017a you cannot use the interactive chart tools nor the pan/zoom methods. 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';


Find more on Visual Exploration 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!