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

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
Answers (1)
Chad Greene
on 13 May 2016
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.
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!