How to show first value on axis cuted with xlim?
6 ビュー (過去 30 日間)
古いコメントを表示
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/268776/image.png)
0 件のコメント
採用された回答
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()] )
0 件のコメント
その他の回答 (2 件)
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])
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!