How can I use the AXIS EQUAL functionality for a 3D plot in MATLAB 7.4 (R2007a) ?
81 ビュー (過去 30 日間)
古いコメントを表示
I would like to be able to make an option in the ‘axis equal’ functionality to select 2 axes only and have the third axis scaled automatically. The following code shows that the ‘axis equal’ functionality doesn’t scale the figure properly:
figure
t = 0:pi/50:10*pi;
subplot(1,2,1); plot3(sin(t),cos(t),t);
title('Normal');
subplot(1,2,2); plot3(sin(t),cos(t),t);
axis equal;
title('Axis equal')
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
The ability to use the AXIS function for 3-D plots is not available in MATLAB.
To work around the issue, it is possible to scale all the three axes by using the 'DataAspectRatio' property of the axes object:
figure
t = 0:pi/50:10*pi;
subplot(1,2,1); plot3(sin(t),cos(t),t);
title('Normal');
subplot(1,2,2); plot3(sin(t),cos(t),t);
h = get(gca,'DataAspectRatio')
if h(3)==1
set(gca,'DataAspectRatio',[1 1 1/max(h(1:2))])
else
set(gca,'DataAspectRatio',[1 1 h(3)])
end
title('Axis equal')
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!