How to make a square Histogram plot with the same range of values over x axis

1 回表示 (過去 30 日間)
Sophia
Sophia 2016 年 5 月 4 日
回答済み: Chad Greene 2016 年 5 月 13 日
figure(1);
clf;
for i = 1:size(wint2_r,3)
tmpwint2_r = squeeze(wint2_r(:,:,i));
tmpwint = tmpwint2_r(:);
subplot(2,6,i);
idx = tmpwint>0;
hist(tmpwint(idx),12);
N = hist(tmpwint(idx));
for j = 1:length(N)
tn(i,j) = N(j);
end
end

回答 (1 件)

Chad Greene
Chad Greene 2016 年 5 月 13 日
You're using
hist(tmpwint(idx),12);
which specifies 12 equally spaced bins over the range of values in tmpwint. If you want all histograms to have the same 12 bins do this
hist(tmpwint(idx),1:12)
to specify bins at 1, 2, 3,..., 12. Or do this
hist(tmpwint(idx),1:0.5:12)
to specify bins at 1, 1.5, 2, 2.5, ..., 12.

カテゴリ

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