Add Specific Numbers to x-axis

조회 수: 40 (최근 30일)
Brave A
Brave A 2021년 2월 27일
댓글: Cris LaPierre 2021년 2월 27일
Hello
I would like to add/show specific numbers in x-axis.Like numbers I showed here 52 and last number 142.

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 2월 27일
Use the xticks and possibly xticklabels function.
x=0:142;
y=linspace(0.1, 2.7,length(x));
bar(x,y)
xline(52,'m--')
xticks(sort([xticks 52 142]));
  댓글 수: 4
Brave A
Brave A 2021년 2월 27일
One more question please, how to remove 0/zeros from axis?
Cris LaPierre
Cris LaPierre 2021년 2월 27일
Which zeros do you want removed?
You could either
  • delete or rename the tick label
  • delete or move the tick
  • change you axis limits to not include 0

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by