Turn off auto stretch for 3D plot in app designer

조회 수: 23 (최근 30일)
Mitchell Lee
Mitchell Lee 2021년 10월 22일
댓글: Mitchell Lee 2021년 10월 22일
As your orbit a 3D plot, the axes are stretched to fill the figure space. I am trying to fix the axes so they do not stretch the shapes to autofill the space.
Here are some things I have tried
- Changing aspect ratio to manual, [1, 1, 1] in the design view
- Using this snip of code after all elements have been drawn
ax = gca;
props = {'CameraViewAngle','DataAspectRatio','PlotBoxAspectRatio'};
set(ax,props,get(ax,props));
- Using this other snip of code
axis vis3d
- Using this last snip of code
pbaspect(app.axes1, [1 1 1])
Most of these things will work in a normal figure but not in the app designer
Even the documentation here says that making the PlotBoxAspectRatioMode manual should disable the autostretch, but it does not.
Thank you in advance.

채택된 답변

Dave B
Dave B 2021년 10월 22일
편집: Dave B 2021년 10월 22일
When you have an axes that you made in App Designer, gca won't return your axes. Can you try your set(ax,props,get(ax,props)) approach with app.axes1?
% This test code was effective at disabling stretch-to-fill for me (in
% R2020b) but I'm not sure if some other property on your axes is
% responsible (hard for me to believe that).
ax=uiaxes;
surf(ax,peaks)
props = {'CameraViewAngle','DataAspectRatio','PlotBoxAspectRatio'};
set(ax,props,get(ax,props));
axis vis3d is similar, I think it should work but you have to be explicit about your target: axis(app.axes1,'vis3d')
  댓글 수: 1
Mitchell Lee
Mitchell Lee 2021년 10월 22일
I had a feeling that was the problem and tried doing stuff like that but I just couldn't get the right syntax. Thank you!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by