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

조회 수: 87 (최근 30일)
Hossam Selim
Hossam Selim 2018년 3월 7일
댓글: Lorenzo Pompili 2024년 4월 13일
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

답변 (6개)

Simon Le Serve
Simon Le Serve 2021년 8월 1일
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
Paulus Ploumen
Paulus Ploumen 2022년 11월 21일
For the 3D scatterplot this works very well, thanks!!

댓글을 달려면 로그인하십시오.


jonas
jonas 2018년 10월 5일
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
Nathaniel Barlow
Nathaniel Barlow 2021년 6월 23일
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
Qianqian Cai 2018년 8월 22일
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
Lorenzo Pompili
Lorenzo Pompili 2024년 4월 13일
Those commands only work in 2D view, as the documentation says.

댓글을 달려면 로그인하십시오.


Rahul jaiswal
Rahul jaiswal 2018년 10월 5일
편집: Rahul jaiswal 2018년 10월 5일
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 2018년 3월 7일
You can use the axis function with a 6 element vector, or use the zlim function directly.
  댓글 수: 1
Hossam Selim
Hossam Selim 2018년 3월 8일
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

댓글을 달려면 로그인하십시오.


MoHa
MoHa 2019년 10월 22일
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

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by