MATLAB Answers


How to exchange between X and Y axes in a 3D graph?

Asked by Alon Rozen on 24 Jun 2019
Latest activity Commented on by Alon Rozen on 24 Jun 2019
I have a 3D graph in 'H' axes in 'My figure' figure. The graph is created by few different functions.
After it is done I want to view the graph when 'X' and 'Y' axes change position in a sense thay 'Y' is the horizontal axis and 'X' is the vertical one.
I tried using 'view' function but faied. I cannot use 'rotate' funciton because data is created in different functions, soem that cannot be changed.
I can easily do it using the Rotate 3D tool on the figure but I want to do it by code after the graph is created.
Is there a way to do it?


Sign in to comment.





1 Answer

Answer by Aquatris
on 24 Jun 2019
Edited by Aquatris
on 24 Jun 2019

You can use a code like;
h = findobj(gca,'Type','line')
This will extract x,y,and z values in the plot. Then, you can do whatever you want with them.

  1 Comment

Thanks Aquatris,
I am not sure that this will work. I have some 3D ellipces there as well as some plots of different markers.
If I could write in code what I can do with the 'Rotate 3D' tool is will solve the problem.
Is there a way to later plot the data again with x and y change place?

Sign in to comment.