Swap axis in 3d figure

조회 수: 28 (최근 30일)
Ana
Ana 2011년 11월 22일
Hello,
I have a 3d plot, for example obtained with a surf command. How can I swap or exchange the x and z axis (with the corresponding ticklabels)?
With the rotate command I can rotate the figure, but the axis remain the same...
Thanks in advance,
Ana

채택된 답변

Jan
Jan 2011년 11월 22일
This dos not exchange the X and the Z axis, but the data:
AxesH = axes;
[x, y, z] = sphere;
H = surf(x, y, z, 'parent', AxesH);
pause(2);
xx = get(H, 'XData');
zz = get(H, 'Zdata');
set(H, 'XData', zz, 'ZData', xx);
Afterwards view() can rotate the scene.
  댓글 수: 3
Jan
Jan 2011년 11월 22일
The property 'CData' controls the color. So you can try one of these methods:
set(H, 'CData', get(H, 'YData'))
set(H, 'CData', get(H, 'ZData'))
set(H, 'CData', get(H, 'XData'))
Perhaps you can to scale the values or define a colormap accordingly.
Ana
Ana 2011년 11월 22일
That's perfect!! Thank you very much!!
Ana

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 11월 22일
Try the view() command
  댓글 수: 1
Ana
Ana 2011년 11월 22일
I have already tried with that command but I cannot manage to get the desired result...

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

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by