フィルターのクリア

X axis is not displaying final value

24 ビュー (過去 30 日間)
Louise Wilson
Louise Wilson 2019 年 8 月 20 日
回答済み: melanie basnak 2019 年 8 月 30 日
I am trying to plot my x-axis from min(x) to max(x) but for some reason the final value wont display, even though the plot runs to the final value.
The values run from 0-115 and I am looking to display 115 on the x-axis, how can I do this?
Thanks!
figure;
colormap(jet); %changes colour scheme
caxis([-80 -45]); % sets scale on colour bar
axis tight;
view(0,90); %flip plot so it becomes 2D
ylim ([0 20000]);
set(gca,'tickdir','out','fontname',... %change size of axes
'arial','fontsize',14);
xlim([0, t(end)]); %change range of x axis
xticks(0:15:115); %x axis labels in intervals of 15
untitled.jpg

採用された回答

melanie basnak
melanie basnak 2019 年 8 月 30 日
It is because when you do xticks(0:15:115) you never get to 115 (i.e., if you start from 0 and ascend 15 at a time, the last number you get is 105, 15 more than that would be 120 and out of your range). You could fix this by either changing it to xticks(0:5:115), which will give you a lot of value, and include 115, or you could choose a specific subset of values, for example
xticks([0 30 60 90 115]);
xticklabels({'0','30','60','90','115'});

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by