time | Calls | line |
---|
| | 1 | function J = jet(m)
|
| | 2 | %JET Variant of HSV
|
| | 3 | % JET(M) returns an M-by-3 matrix containing the jet colormap, a variant
|
| | 4 | % of HSV(M). The colors begin with dark blue, range through shades of
|
| | 5 | % blue, cyan, green, yellow and red, and end with dark red. JET, by
|
| | 6 | % itself, is the same length as the current figure's colormap. If no
|
| | 7 | % figure exists, MATLAB uses the length of the default colormap.
|
| | 8 | %
|
| | 9 | % See also PARULA, HSV, HOT, PINK, FLAG, COLORMAP, RGBPLOT.
|
| | 10 |
|
| | 11 | % Copyright 1984-2015 The MathWorks, Inc.
|
| | 12 |
|
< 0.001 | 8 | 13 | if nargin < 1
|
| | 14 | f = get(groot,'CurrentFigure');
|
| | 15 | if isempty(f)
|
| | 16 | m = size(get(groot,'DefaultFigureColormap'),1);
|
| | 17 | else
|
| | 18 | m = size(f.Colormap,1);
|
| | 19 | end
|
< 0.001 | 8 | 20 | end
|
| | 21 |
|
< 0.001 | 8 | 22 | n = ceil(m/4);
|
0.001 | 8 | 23 | u = [(1:1:n)/n ones(1,n-1) (n:-1:1)/n]';
|
< 0.001 | 8 | 24 | g = ceil(n/2) - (mod(m,4)==1) + (1:length(u))';
|
< 0.001 | 8 | 25 | r = g + n;
|
< 0.001 | 8 | 26 | b = g - n;
|
< 0.001 | 8 | 27 | g(g>m) = [];
|
< 0.001 | 8 | 28 | r(r>m) = [];
|
< 0.001 | 8 | 29 | b(b<1) = [];
|
< 0.001 | 8 | 30 | J = zeros(m,3);
|
< 0.001 | 8 | 31 | J(r,1) = u(1:length(r));
|
< 0.001 | 8 | 32 | J(g,2) = u(1:length(g));
|
< 0.001 | 8 | 33 | J(b,3) = u(end-length(b)+1:end);
|
Other subfunctions in this file are not included in this listing.