www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ColorHistogramsByBarHeightExample.m

    %% Color Histogram Bars by Height
% Create a bivariate histogram using 1,000 normally distributed random
% numbers with 12 bins in each dimension. Specify |FaceColor| as |'flat'|
% to color the histogram bars by height.

% Copyright 2015 The MathWorks, Inc.

h = histogram2(randn(1000,1),randn(1000,1),[12 12],'FaceColor','flat');
colorbar