X axis is not displaying final value
조회 수: 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

댓글 수: 0
채택된 답변
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
추가 답변 (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!