필터 지우기
필터 지우기

Move axes in 3D plot

조회 수: 15 (최근 30일)
Panagiotis Artemiou
Panagiotis Artemiou 2023년 11월 7일
답변: Benjamin Kraus 2023년 11월 7일
Hello,
I have 3D plot as shown in the image below.
I added the 3 axes with black color. I do not want the axes to be shown at the bottom and on the side like it is plotted by default. I wish to force them somehow to be intersect at (0,0,0) and to be shown as the image above and I have some trouble doing that.
I tried the command:
set(gca, 'XAxisLocation', 'origin', 'YAxisLocation', 'origin')
but did not work.
Is there a way to do that?

채택된 답변

Benjamin Kraus
Benjamin Kraus 2023년 11월 7일
Unfortunately, the XAxisLocation and YAxisLocation properties only work for 2D axes.
Which means your only option is to draw those lines manually.
If you are OK with no ticks or tick labels, there are a few options you can consider, but my favorite is probably fplot3.
ax = axes;
hold(ax,'on')
xl = fplot3(ax,@(t) t, @(t) zeros(size(t)), @(t) zeros(size(t)),'SeriesIndex','none');
yl = fplot3(ax,@(t) zeros(size(t)), @(t) t, @(t) zeros(size(t)),'SeriesIndex','none');
zl = fplot3(ax,@(t) zeros(size(t)), @(t) zeros(size(t)), @(t) t,'SeriesIndex','none');
view(ax,3)
grid(ax,'on')
ax.XAxis.Visible = 'off';
ax.YAxis.Visible = 'off';
ax.ZAxis.Visible = 'off';

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by