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

1 visualización (últimos 30 días)
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

Respuestas (1)

Chad Greene
Chad Greene el 13 de Mayo de 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.

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by