How to plot histogram where the data is the height

20 ビュー (過去 30 日間)
Wilson Zheng
Wilson Zheng 2020 年 9 月 13 日
回答済み: Steven Lord 2020 年 9 月 13 日
Hi all, I'm trying to plot a histogram with the data I have being the "amount" and not the bins. So my x-axis would be from 0 to 10, and I want the bar for 0 to be 107 units high, my bar for 1 to be 979 units high etc. How would I do this? If my array is [107, 979, 4485 ... ] the "histogram" functions do not work

採用された回答

VBBV
VBBV 2020 年 9 月 13 日
%if true
% code
%end
x = 0:10;
y = [20 120 133 34 45 37 180 12 100 30 12]; % example values
bar(x,y)

その他の回答 (1 件)

Steven Lord
Steven Lord 2020 年 9 月 13 日
histogram('BinEdges', [0 1 2], 'BinCounts', [107 55])

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by