-
Notifications
You must be signed in to change notification settings - Fork 0
/
jet0.m
36 lines (34 loc) · 1.08 KB
/
jet0.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function J = jet0(m)
%JET0 Variant of JET.
% JET0(M), a variant of JET(M), is the colormap used with the
% NCSA fluid jet image, but with the central colors set to white.
% JET0, by itself, is the same length as the current colormap.
% Use COLORMAP(JET0).
%
% See also JET, HSV, HOT, PINK, FLAG, COLORMAP, RGBPLOT.
% taken from jet.m, Martin Losch, 3-8-02
% C. B. Moler, 5-10-91, 8-19-92.
% Copyright 1984-2001 The MathWorks, Inc.
% $Revision: 1.3 $ $Date: 2006/08/12 20:25:12 $
% $Header: /u/gcmpack/MITgcm/verification/tutorial_global_oce_latlon/diags_matlab/jet0.m,v 1.3 2006/08/12 20:25:12 jmc Exp $
% $Name: checkpoint59p $
if nargin < 1, m = size(get(gcf,'colormap'),1); end
n = max(round(m/4),1);
x = (1:n)'/n;
y = (n/2:n)'/n;
e = ones(length(x),1);
r = [0*y; 0*e; x; e; flipud(y)];
g = [0*y; x; e; flipud(x); 0*y];
b = [y; e; flipud(x); 0*e; 0*y];
J = [r g b];
while size(J,1) > m
J(1,:) = [];
if size(J,1) > m, J(size(J,1),:) = []; end
end
% set central colors to white
if mod(m,2)
ic = ceil(m/2);
J(ic-1:ic+1,:) = ones(3,3);
else
J(m/2:m/2+1,:) = ones(2,3);
end