x = randn(100, 1); % generate some data bins1 = -4:2:4; % large bins bins2 = -4:0.5:4; % small bins [h1,b1] = hist(x,bins1); [h2,b2] = hist(x,bins2); subplot( 1, 2, 1 ); bar(b1, h1) hold on bar(b2, h2, 'facecolor', 'r' ) xlabel('x') ylabel('Frequency') hold off