How to: Axis Xtick steps
30 次查看(过去 30 天)
显示 更早的评论
I plot something and Matlab auto chooses the axis step as 5, I want it 1.
how can i say that the step size should be 1.
I know you can use:
set(gca,'YTick',[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 etc]);
but this is just too long :)
1 个评论
Jan
2013-1-9
A more compact form of the question:
How can I express "[1,2,3,4...]" shorter.
Defining vectors and arrays is one of the absolutely fundamental basics in Matlab. Therefore the language is called "Mat(rix)lab". Reading the "Getting Started" chapters of the documentation explains the basic usage of Matlab exhaustively. Therefore reading them is strongly recommended, while a forum is not the right place learning this.
采纳的回答
更多回答(2 个)
Ayomide Olabode
2019-10-12
For a duirnal dataset for instance, do:
xlim([0 24]);
set(gca,'XTick',[0:2:24]) i.e. set(gca,'XTick',[minimum:stepsize:maximum])
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Performance and Memory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!