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 で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

