App Designer: XY Zoom and XY Pan settings

조회 수: 5 (최근 30일)
mackhina
mackhina 2020년 1월 19일
댓글: Nishant Gupta 2020년 1월 23일
Hi everyone,
Is there a way to lock/choose the XY settings for the zoom and pan features when viewing a 3D surf plot in App Designer?
scroll.png
Using the zoom in the App Designer is giving me big holes in the middle of my surf plots that I don't know how to stop? Any help would be greatly appreciated!
contour hole.png
Thanks in advance!
Cheers

채택된 답변

mackhina
mackhina 2020년 1월 22일
편집: mackhina 2020년 1월 23일
This solutions seems to work to maintain the Z-Axis for both the zoom and pan: UIAxes' YLim property cannot be listened to
I added the function to app designer:
function [inclusivezlim] = mapholdaltlims(app,ax)
objwithz = findobj(app.UIAxes.Children,'-property','ZData');
currmin_z = 0;
currmax_z = 0;
for i = 1:length(objwithz)
currmin_z = min([min(min(objwithz(i).ZData)), currmin_z]);%Need double mins because data could be 2d surface
currmax_z = max([max(max(objwithz(i).ZData)), currmax_z]);
end
inclusivezlim = [currmin_z currmax_z];
ax.ZLim = inclusivezlim;
end
And included the following in each of my plot functions:
warning('off','MATLAB:structOnObject');
warning('off','MATLAB:ui:javaframe:PropertyToBeRemoved'); % Added to turn off java warning
addlistener(struct(app.UIAxes).Axes, 'ZLim', 'PostSet', @(src,evnt)mapholdaltlims(app,app.UIAxes));
There is a delay after zooming/panning, when the Z-Axis is replotted, so it's not the fastest solution, but it does works!
Getting lots of warnings that I don't understand either? Does this mean this function will not work in future versions of Matlab?
Warning: The JavaFrame figure property will be removed in a future release. For more information, see
Recommendations for Java and ActiveX Users on mathworks.com.
> In func_name/startupFcn (line 76)
In appdesigner.internal.service/AppManagementService/tryCallback (line 336)
In matlab.apps/AppBase/runStartupFcn (line 41)
In func_name (line 565)
In appdesigner.internal.service/AppManagementService/runAppWithTryCatch (line 161)
In appdesigner.internal.service/AppManagementService/runDesktopApp (line 89)
In appdesigner.internal.model/AppModel/runAppHelper (line 649)
In appdesigner.internal.model.AppModel>@()appdesigner.internal.model.AppModel.runAppHelper(obj,appArguments) (line 509)
  댓글 수: 1
Nishant Gupta
Nishant Gupta 2020년 1월 23일
Hi,
Since the callback is involved So, it might take the time to load the data and process it according to the callback function. This might be the reason its slow. The Last warnings are because of the warning function that is created as it access JavaFrame and it may not be there in future release.

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

추가 답변 (2개)

Nishant Gupta
Nishant Gupta 2020년 1월 22일
Hi,
Most probably its because clipping of the plot is taking place when you are zooming in, just set 'clipping' property of UIaxes to 'off'.
app.UIAxes.Clipping = 'off';

mackhina
mackhina 2020년 1월 22일
That stops the clipping in the Z axis, but I get axes now show through the plot when I zoom in, so the data isn't really useable from an end user perspective :(

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by