How to zoom in/out on the figures in app designer

I cannot find the method for adding an toolbar with function of zoom in/out in the app designer, if it is not been supported now?

1 comentario

Blanca Larraga
Blanca Larraga el 28 de Mayo de 2018
Movida: Adam Danz el 14 de Jun. de 2023
Is there any option to just apply the zoom option to one of the two axis? Thank you very much in advance.
Best regards, Blanca

Iniciar sesión para comentar.

 Respuesta aceptada

Adam Danz
Adam Danz el 12 de Dic. de 2019
Editada: Adam Danz el 14 de Jun. de 2023

0 votos

Zooming and panning was supported in MATLAB R2017a but you had to turn those interaction on.
Starting in R2018b, those interations were on by default.
Starting in R2019a those interactions became available in the toolbar.

Más respuestas (4)

Mirek Janda
Mirek Janda el 16 de Abr. de 2018
Editada: Mirek Janda el 18 de Abr. de 2018

You can try this:

               pan(app.UIAxes,'on');
               zoom(app.UIAxes,'on');

Then create a button to get the zoom 'off' and reset the axis:

                 zoom(app.UIAxes,'off');
                 app.UIAxes.XLimMode = 'auto';
                 app.UIAxes.YLimMode = 'auto';

3 comentarios

good answer. I wonder why they support this but not
zoom(app.UIAxes, 'out')
?
T.A.S.
T.A.S. el 2 de Jul. de 2018
Editada: T.A.S. el 2 de Jul. de 2018
Can you provide an example code in app designer with the callbacks?
Sure. In standard matlab I can do this:
figure
plot(1:10)
drawnow
zoom(gca,'on') %start zoom mode
keyboard
%click, zooms in
zoom(gca,'out') %zooms out
keyboard
%check that figure is zoomed out
zoom(gca,'off') %exit zoom mode
If I have an axes in appdesigner, I can do
zoom(app.UIAxes, 'on')
%now clicking/scrolling in the figure will zoom in
zoom(app.UIAxes, 'off')
but not
>> zoom(app.UIAxes, 'out')
Error using matlab.ui.control.UIAxes/togglemode
Unknown action character vector.

Iniciar sesión para comentar.

Chris Portal
Chris Portal el 10 de Abr. de 2016

3 votos

Unfortunately, App Designer does not offer support for adding a toolbar at this time.

2 comentarios

Nathan Gyger
Nathan Gyger el 23 de Dic. de 2016
What a pity!
try this workaround pleas: zoom(app.UIAxes,'on')

Iniciar sesión para comentar.

Luciano Junior
Luciano Junior el 9 de En. de 2018

0 votos

Try to build your on zoom ;) Once your figure is ploted, add an edit field (here you should insert the specific area in your figure to where you want to zoom) after add a slider to control the zoom (the slider values should control your Xlim) add a callback to the slider in order to plot the figure again (use the same code you used to plot the figure but now use the edit field and the slider values to control your XLim) everytime you change the slider value your figure will be updated.
Good luck!
Ana Gonçalves
Ana Gonçalves el 19 de Mayo de 2022

0 votos

Make sure to check if the 'PickableParts' and 'HitTest' are set like in this picture. This solved my problem, hope that it solve yours too.

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Preguntada:

el 28 de Mzo. de 2016

Movida:

el 14 de Jun. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by