How to change x-axis values?
이전 댓글 표시
Hello guys,
Matlab automatically put the x-axis values into x10 format. For example 1.96 x10^7 instead of 1996. This is wrong.
How can I make x-axis values to look like whole number values i.e. 1996, 1998 etc?
Thank you.
답변 (1개)
Daniel Pollard
2020년 12월 15일
This was the top result when I googled "matlab remove scientific notation axis".
From R2015b onwards,
ax = gca;
ax.XRuler.Exponent = 0;
댓글 수: 14
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
Daniel Pollard
2020년 12월 15일
In your post you said that the numbers show 1.96x10^7 instead of 1996. If these are years, then there's a problem with your dataset as 1.96x10^7 = 1,960,000, not 1996.
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
Daniel Pollard
2020년 12월 15일
No, it will be 1960 x10^4, but I think that's ok looking at your data as the temperature seems to oscillate 20 times between 1.96 and 1.98. A quick and dirty fix would be to divide the numbers by 1000, is there any reason you shouldn't do that?
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
Daniel Pollard
2020년 12월 15일
There's some bizzare things going on there. Why do you divide the date_data by 10000 as you import it? You then overwrite the xlim with 1:length(years), then relabel it with the date_data, manually doing what would have been automatic.
Why not just import the date_data and temperature_data and plot them against each other?
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
Daniel Pollard
2020년 12월 15일
That is strange and suggests that it's an issue with those particular data. Maybe someone else in your class or a professor can help more as they have the data and understand better than me.
Catayoun Lissa Eleonore Azarm
2020년 12월 15일
You have to apply same to
%
subplot(5,3,1)
subplot(5,3,6)
subplot(5,3,11)
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

