rwb.m

来自「PLS_Toolbox是用于故障检测与诊断方面的matlab工具箱」· M 代码 · 共 31 行

M
31
字号
function map = rwb(m)
%RWB Red-white-blue color map
%  Creates a red to white to blue colormap, useful for plotting
%  values that range from -1 to 1, such as those generated by
%  CORRMAP. The optional input (m) specifies the length of the
%  colormap. With no inputs, RWB returns a colormap the same
%  length as the current colormap. The output (map) is the 
%  m-by-3 colormap matrix.
%
%I/O: map = rwb(m);
%
% See also BONE, COLORMAP, COOL, COPPER, CORRCOEF, CORRMAP,
%          FLAG, GRAY, HOT, HSV, PINK


%Copyright Eigenvector Research, Inc. 1999
%BMW  12/28/99

if nargin < 1 
  m = size(get(gcf,'colormap'),1); 
end
n = fix(m/2);
nn = m-n;
gr = fix(m/16);

r = [ones(nn,1); (n-1:-1:1)'/(n-1); 0];
g = [zeros(gr,1); (1:n-gr)'/(n-gr); (nn-gr:-1:1)'/(nn-gr); zeros(gr,1)];
b = flipud(r);

map = flipud([r g b]);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?