change x,y,z axes position in a 3d plot graph

60 visualizzazioni (ultimi 30 giorni)
Hossam Selim
Hossam Selim il 7 Mar 2018
Commentato: Lorenzo Pompili il 13 Apr 2024
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

Risposte (6)

Simon D. Porcella
Simon D. Porcella il 1 Ago 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

jonas
jonas il 5 Ott 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 Commento
Nathaniel Barlow
Nathaniel Barlow il 23 Giu 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.

Accedi per commentare.


Qianqian Cai
Qianqian Cai il 22 Ago 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.

Rahul jaiswal
Rahul jaiswal il 5 Ott 2018
Modificato: Rahul jaiswal il 5 Ott 2018
XAxisLocation = 'origin'; ax.YAxisLocation = 'origin'; This code is not working for the 3D coordinate axis. Are you find the answer to this question?

Rik
Rik il 7 Mar 2018
You can use the axis function with a 6 element vector, or use the zlim function directly.
  1 Commento
Hossam Selim
Hossam Selim il 8 Mar 2018
Thanks for your answer, but this does not change the position of the axes for a 3d plot. I do not want to change axes limits, I need to change position. I appreciate if there is another suggestion regards, Hossam

Accedi per commentare.


MoHa
MoHa il 22 Ott 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 HelpVergleich-M2C-LaborScan-plotAlsContour(in Clouadcompare).JPG Vergleich-M2C-LaborScan.jpg

Categorie

Scopri di più su Graphics Object Properties in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by