グラフのy軸の目盛りラベルにて、整数部の表示桁数を指定する方法について
19 次查看(过去 30 天)
显示 更早的评论
下記のようなグラフを表示するコードで、大きな整数値だと指数表示になって細かい値が見れなくなってしまいます。
「1x10^5」のように指数表示せず、「100001 100002 100003 100004 100005」という値をそのまま縦軸に表示する方法を知りたいです。
小数部の精度はytickformat関数で指定できますが、整数部の表示桁数を指定する方法などはあるのでしょうか。
x = 1:5;
y = [100001 100002 100003 100004 100005];
plot(x, y);
ytickformat('%d');

0 个评论
采纳的回答
Dyuman Joshi
2023-11-15
编辑:Dyuman Joshi
2023-11-15
The ticklabels are stored as the mantissa and the exponent is stored as the property of the corresponding axis (see below).
So, changing the tick format only changes the values of the mantissa.
Solution - Change the exponent of the y-axis to 0
x = 1:5;
y = [100001 100002 100003 100004 100005];
labels = yticklabels
plot(x, y)
ax = gca;
ax.YAxis.Exponent = 0;
%Check labels after modification
labels = yticklabels
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pie Charts 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
