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

    %% Control Scaling of Data Values into Colormap
% Create |C| as an array of data values. Create an image of |C| and set the
% color limits so that values of 4 or less map to the first color in the
% colormap and values of 18 or more map to the last color in the colormap.
% Display a colorbar to show how the data values map into the colormap.

% Copyright 2015 The MathWorks, Inc.


C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
clims = [4 18];
imagesc(C,clims)
colorbar