How can I control xticklabel?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello All,
I have serial of datenum on X-axis, I would like to show in my plot that the first datetick is the first datenum number and the end is the end of datenum number.
please any one could help me?
Thanks in advance
Riyadh
0 件のコメント
回答 (1 件)
Walter Roberson
2016 年 12 月 15 日
That would happen automatically.
x = datenum('Jan 17, 2016') : datenum('Jan 23, 2016');
y = mod(x, 4);
plot(x,y);
If the difficulty is with it automatically putting the label in scientific notation then:
In R2015a or later (might need R2015b):
ax = gca;
ax.XAxis.Exponent = 0;
In earlier versions (including R2014b, which did not have the Numeric Ruler properties yet even though it was HG2):
set(gca,'XTickLabel', cellstr( num2str( reshape(get(gca,'XTick'),[],1) ) ) )
2 件のコメント
Walter Roberson
2016 年 12 月 15 日
Could you give some sample data? I get the impression that your T might contain date vectors, something like an array of [2016 12 14 19 48 18.5665000000008] ?
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!