Swap axis in 3d figure

10 次查看(过去 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 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by