app designer how to make zoom out for my plot ?

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 comentario

Adam Danz
Adam Danz el 12 de Dic. de 2019
Editada: Adam Danz el 16 de Dic. de 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.
app.UIAxes.YTick

Iniciar sesión para comentar.

Respuestas (1)

Adam Danz
Adam Danz el 12 de Dic. de 2019
Editada: Adam Danz el 14 de Jun. de 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 comentarios

Paulo
Paulo el 23 de Mayo de 2024
how do you go about it if you have an image instead of UIAxes
Adam Danz
Adam Danz el 23 de Mayo de 2024
Are you referring to an image added by uiimage or an image within an axes?
Svenja Jetzinger
Svenja Jetzinger el 24 de Mayo de 2024
I created two UIAxes boxes named UIAxes1 and UIAxes2, each displaying different images. The toolbar is displayed, but when I want to zoom in or out or move the displayed image (using mouse scrolling or drawing a rectangle on the displayed image), it doesn't work.
Randomly, I found out that if I "draw" the rectangle in the top right corner of the screen, my image in the middle of the screen (UIAxes1) will be enlarged.
The UIAxes2 positioned in the top right corner also shows the toolbar, but I have absolutely no idea where to zoom in.
What is the problem? Is it possible to draw directly on the image displayed in the UIAxes boxes to zoom in/out? What can I do?
This example creates an image in a uiaxes. The toolbar is displayed and both pan and zoom are enabled.
image(uiaxes(uifigure()),imread("peppers.png"))
Do you experience the symptoms you described using this line above? If so, what MATLAB release are you using? If not, please share a small sample of code I can run to reproduce the problem.
Svenja Jetzinger
Svenja Jetzinger el 27 de Mayo de 2024
Editada: Svenja Jetzinger el 27 de Mayo de 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.
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)

Iniciar sesión para comentar.

Categorías

Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.

Preguntada:

el 12 de Dic. de 2019

Comentada:

el 28 de Mayo de 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by