Swap axis in 3d figure

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

 Respuesta aceptada

Jan
Jan el 22 de Nov. de 2011

2 votos

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 comentarios

Ana
Ana el 22 de Nov. de 2011
That is exactly what I needed! Thank you very much!
The only thing I would may like to change is the axe which the color is referenced to. Is there any easy way to do this?
Thank you again!
Jan
Jan el 22 de Nov. de 2011
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 el 22 de Nov. de 2011
That's perfect!! Thank you very much!!
Ana

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 22 de Nov. de 2011

0 votos

Try the view() command

1 comentario

Ana
Ana el 22 de Nov. de 2011
I have already tried with that command but I cannot manage to get the desired result...

Iniciar sesión para comentar.

Preguntada:

Ana
el 22 de Nov. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by