How to make a square Histogram plot with the same range of values over x axis
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!