app designer how to make zoom out for my plot ?

25 visualizaciones (últimos 30 días)
tomer polsky
tomer polsky el 12 de Dic. de 2019
Comentada: Adam Danz el 28 de Mayo de 2024
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
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.
Adam Danz
Adam Danz el 28 de Mayo de 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)

Iniciar sesión para comentar.

Categorías

Más información sobre Interaction Control en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by