Change values of 'x-axis (bar graph) as integers

11 ビュー (過去 30 日間)
Alberto Acri
Alberto Acri 2023 年 8 月 22 日
コメント済み: Star Strider 2023 年 8 月 22 日
Hi! I have an example of a generated bar graph:
Automatically Matlab generates an x-axis with the values multiplied by 10^4. Is it possible to avoid using 10^4?
So for example 0.5*10^4 becomes 5000, 1*10^4 becomes 10000... I would like to directly enter the values 5000, 10000,....

採用された回答

Dyuman Joshi
Dyuman Joshi 2023 年 8 月 22 日
%Random data
x = 0:4e4;
y = x.^2-x;
plot(x,y)
figure
plot(x,y)
%Get x tick values
t = xticks;
%Create a string with x tick values in integer format
str = compose("%d", t);
%Use the string as x tick labels
xticklabels(str)
  1 件のコメント
Star Strider
Star Strider 2023 年 8 月 22 日
Another option could be to use the Exponent property.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by