1 |
function rgb = seismic(n); |
2 |
|
3 |
% seismic(n) creates a colormap, ranging from dark blue via white to dark red. |
4 |
% |
5 |
% Nico Sneeuw |
6 |
% Munich, 31/08/94 |
7 |
|
8 |
if nargin == 0, n = size(get(gcf,'colormap'),1); end |
9 |
|
10 |
m = ceil(n/3); |
11 |
top = ones(m,1); |
12 |
bot = zeros(m,1); |
13 |
up = (0:m-1)'/m; |
14 |
down = flipud(up); |
15 |
|
16 |
r = [bot; up; 1; top; down]; |
17 |
g = [bot; up; 1; down; bot]; |
18 |
b = [up; top; 1; down; bot]; |
19 |
rgb = [r g b]; |
20 |
|
21 |
% rgb-map has size 4m+1 now. The central part will be extracted. |
22 |
|
23 |
xlarge = 4*m+1-n; |
24 |
xblue = round(xlarge/2); |
25 |
xred = xlarge - xblue; |
26 |
rgb([1:xblue 4*m-xred+2:4*m+1],:) = []; |