📄 rwb.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -