How to plot a Bar Graph without a uniform spacing on the horizontal axis

3 ビュー (過去 30 日間)
Tarek Hajj Shehadi
Tarek Hajj Shehadi 2021 年 5 月 10 日
コメント済み: Tarek Hajj Shehadi 2021 年 5 月 10 日
Hello, suppose I have a bar graph where I am testing some data with How can I have these four values spaced equally on the horizotnal axis?

採用された回答

KSSV
KSSV 2021 年 5 月 10 日
編集済み: KSSV 2021 年 5 月 10 日
You can plot the values by index and show the respective values uisng text.
Example:
x = [5 10 100 1000] ;
y = rand(size(x)) ;
bar(y)
text(1:length(x),y,num2str(x'),'vert','bottom','horiz','center');
Or, use xticklabels and show the values at the x-axes.
Example:
x = [5 10 100 1000] ;
y = rand(size(x)) ;
bar(y)
xticklabels(x)

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by