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

조회 수: 53 (최근 30일)
Zhangjun Yu
Zhangjun Yu 2016년 3월 28일
이동: Adam Danz 2023년 6월 14일
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
Blanca Larraga
Blanca Larraga 2018년 5월 28일
이동: Adam Danz 2023년 6월 14일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2019년 12월 12일
편집: Adam Danz 2023년 6월 14일
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.

추가 답변 (4개)

Mirek Janda
Mirek Janda 2018년 4월 16일
편집: Mirek Janda 2018년 4월 18일

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
T.A.S.
T.A.S. 2018년 7월 2일
편집: T.A.S. 2018년 7월 2일
Can you provide an example code in app designer with the callbacks?
craq
craq 2018년 7월 27일
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.

댓글을 달려면 로그인하십시오.


Chris Portal
Chris Portal 2016년 4월 10일
Unfortunately, App Designer does not offer support for adding a toolbar at this time.
  댓글 수: 2
Nathan Gyger
Nathan Gyger 2016년 12월 23일
What a pity!
Waleed Sahhary
Waleed Sahhary 2018년 11월 5일
try this workaround pleas: zoom(app.UIAxes,'on')

댓글을 달려면 로그인하십시오.


Luciano Junior
Luciano Junior 2018년 1월 9일
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!
  댓글 수: 1
Ioannis
Ioannis 2022년 8월 24일
Could you suggest any documentation for that task?

댓글을 달려면 로그인하십시오.


Ana Gonçalves
Ana Gonçalves 2022년 5월 19일
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.

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by