필터 지우기
필터 지우기

How to show first value on axis cuted with xlim?

조회 수: 9 (최근 30일)
I G
I G 2020년 1월 28일
답변: ME 2020년 1월 28일
I am using xlim to make my axis shorter, but on that way Matlab does not show me first value on shorter axis.
More detailed: I am using command xlim([1 21]); and I need that number 1 on the x axis. How should I correct that, instead of using some graphic programs?
This zero on picture is from vertical axis, I am looking for the first value on the horizontal axis.

채택된 답변

Walter Roberson
Walter Roberson 2020년 1월 28일
Altering the xlim is not going to change the automatic tick calculation, which tries for 4 to 5 ticks at nice "round" numbers. If you want the first value labeled you need to put in an xtick there.
xticks( [1, xticks()] )

추가 답변 (2개)

ME
ME 2020년 1월 28일
I just tried your way and I am getting the zero showing up on the x-axis so I'm not sure what is going on there.
As an alternative you could try using axis instead and see if that helps.
axis([x_min x_max y_min y_max])
  댓글 수: 1
I G
I G 2020년 1월 28일
편집: I G 2020년 1월 28일
Maybe I did not explain on the correct way. I am using command xlim([1 21]); and I need that number 1 on the x axis.
With
axis([x_min x_max y_min y_max])
as you suggested is the same, without 1 on x axis.

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


ME
ME 2020년 1월 28일
Sorry, that's my fault.
In that case you'll need to change the tick locations - see the below for more information.

카테고리

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

태그

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by