X axis is not displaying final value
20 views (last 30 days)
Show older comments
Louise Wilson
on 20 Aug 2019
Answered: melanie basnak
on 30 Aug 2019
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
0 Comments
Accepted Answer
melanie basnak
on 30 Aug 2019
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 Comments
More Answers (0)
See Also
Categories
Find more on Orange in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!