change x,y,z axes position in a 3d plot graph
100 views (last 30 days)
Show older comments
Good Evening, I need to change position of axes in a 3d graph. I tried to do that using graph properties but it does not work, Matlab has this option in 2D plot in axis properties window in the graph, but it does not work in 3d plots. I was wondering if there is a way to do it. please find attached the graph i need to change its axes positions (arrows and text in red arethe new position I want the axes to be placed at). the info from matlab documentation that says that this option works only in 2d plots is attahced as well. Thanks a lot
Best regards, Hossam
1 Comment
cui,xingxing
on 19 Aug 2022
Edited: cui,xingxing
on 19 Aug 2022
hi, May I ask how you set the Z-axis to be directly in front and the y-axis to be displayed vertically?
Answers (6)
Simon Le Serve
on 1 Aug 2021
this works for me:
box off;
grid off;
hAxis = gca;
hAxis.XRuler.FirstCrossoverValue = 0; % X crossover with Y axis
hAxis.XRuler.SecondCrossoverValue = 0; % X crossover with Z axis
hAxis.YRuler.FirstCrossoverValue = 0; % Y crossover with X axis
hAxis.YRuler.SecondCrossoverValue = 0; % Y crossover with Z axis
hAxis.ZRuler.FirstCrossoverValue = 0; % Z crossover with X axis
hAxis.ZRuler.SecondCrossoverValue = 0; % Z crossover with Y axis
1 Comment
jonas
on 5 Oct 2018
A bit late to the party, but there's a pretty neat undocumented feature that lets you control the position of the rulers in 2d and 3d.
The XRuler property is called XAxis in later releases, but I believe you can still use both (?). Here's an example:
1 Comment
Nathaniel Barlow
on 23 Jun 2021
The commands in the first link worked for me! In particular,
hAxis=gca;
hAxis.YRuler.SecondCrossoverValue = 0;
hAxis.XRuler.SecondCrossoverValue = 0;
is what I needed to do, but go to the link to for more details on your needs.
Qianqian Cai
on 22 Aug 2018
For x-axis and y-axis, you can use ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin'; For z-axis, I don't have any good ideas.
1 Comment
Rahul jaiswal
on 5 Oct 2018
Edited: Rahul jaiswal
on 5 Oct 2018
XAxisLocation = 'origin'; ax.YAxisLocation = 'origin'; This code is not working for the 3D coordinate axis. Are you find the answer to this question?
0 Comments
MoHa
on 22 Oct 2019
Hi
what about Rotation of the axis to have suitable 2D plot of a 3D object. please look at photos.
is that possible to rotate the Graf in matlab? first is correct view (front), second is view of x-z plane.
Thanks for Help
![Vergleich-M2C-LaborScan.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/244000/image.jpeg)
![Vergleich-M2C-LaborScan-plotAlsContour(in Clouadcompare).JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/243999/image.jpeg)
![Vergleich-M2C-LaborScan.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/244000/image.jpeg)
0 Comments
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!