필터 지우기
필터 지우기

How to remove certain tick labels from xaxis in line plot

조회 수: 14 (최근 30일)
Aaron Ouyang
Aaron Ouyang 2022년 7월 12일
답변: Star Strider 2022년 7월 12일
Hi,
I've been graphing this line plot. Currently my x-axis has tick labels from 0 to 3000 seconds in 500 second intervals as shown below. How can I remove all the x-axis tick labels except for the label at 3000? Thanks.

채택된 답변

Star Strider
Star Strider 2022년 7월 12일
Try something like this —
t = linspace(0, 3000, 3000);
s = (sin(2*pi*t*5)>0.9)*6.8 + 0.1;
figure
plot(t, s)
figure
plot(t, s)
xt = xticks;
set(gca,'XTick',max(xt));
.

추가 답변 (1개)

Anay Aggarwal
Anay Aggarwal 2022년 7월 12일
Hi Aaron,
I have an understanding that you want to remove tick labels from the x-axis.
Please refer to the following page for details.
Regards

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by