https://github.com/HTDerekLiu/SpecCoarsen_MATLAB
Tip revision: 749b4bf2aa89143c0b50c9a2a50a6fbd6b115919 authored by HTDerekLiu on 12 September 2019, 16:56:12 UTC
update number of eVec in use
update number of eVec in use
Tip revision: 749b4bf
myColorMap.m
function CMap = myColorMap(type)
if nargin < 1
type = 'default';
end
if strcmp(type,'default')
colors = ...
[103, 0, 31; ...
178, 24, 43; ...
214, 96, 77; ...
244, 165, 130; ...
253, 219, 199; ...
209, 229, 240; ...
146, 197, 222; ...
67, 147, 195; ...
33, 102, 172; ...
5, 48, 97] / 255;
stepSize = 500;
CMap = zeros((size(colors,1)-1)*stepSize, 3);
for i = 1:size(colors,1)-1
c1 = colors(i,:);
c2 = colors(i+1,:);
CMap((i-1)*stepSize+1:i*stepSize, 1) = linspace(c1(1),c2(1),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 2) = linspace(c1(2),c2(2),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 3) = linspace(c1(3),c2(3),stepSize);
end
elseif strcmp(type,'red')
colors = ...
[255,247,236;...
254,232,200;...
253,212,158;...
253,187,132;...
252,141,89;...
239,101,72;...
215,48,31;...
179,0,0;...
127,0,0] / 255;
colors = flipud(colors);
stepSize = 500;
CMap = zeros((size(colors,1)-1)*stepSize, 3);
for i = 1:size(colors,1)-1
c1 = colors(i,:);
c2 = colors(i+1,:);
CMap((i-1)*stepSize+1:i*stepSize, 1) = linspace(c1(1),c2(1),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 2) = linspace(c1(2),c2(2),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 3) = linspace(c1(3),c2(3),stepSize);
end
elseif strcmp(type,'blue')
colors = ...
[255,247,251; ...
236,231,242; ...
208,209,230; ...
166,189,219; ...
116,169,207; ...
54,144,192; ...
5,112,176; ...
4,90,141; ...
2,56,88] / 255;
stepSize = 500;
CMap = zeros((size(colors,1)-1)*stepSize, 3);
for i = 1:size(colors,1)-1
c1 = colors(i,:);
c2 = colors(i+1,:);
CMap((i-1)*stepSize+1:i*stepSize, 1) = linspace(c1(1),c2(1),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 2) = linspace(c1(2),c2(2),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 3) = linspace(c1(3),c2(3),stepSize);
end
% elseif strcmp(type,'test')
% colors = ...
% [239,243,255
% 198,219,239
% 158,202,225
% 107,174,214
% 66,146,198] / 255;
%
% stepSize = 500;
% CMap = zeros((size(colors,1)-1)*stepSize, 3);
% for i = 1:size(colors,1)-1
% c1 = colors(i,:);
% c2 = colors(i+1,:);
% CMap((i-1)*stepSize+1:i*stepSize, 1) = linspace(c1(1),c2(1),stepSize);
% CMap((i-1)*stepSize+1:i*stepSize, 2) = linspace(c1(2),c2(2),stepSize);
% CMap((i-1)*stepSize+1:i*stepSize, 3) = linspace(c1(3),c2(3),stepSize);
% end
elseif strcmp(type,'heat')
colors = ...
[255,247,236;...
255,247,236;...
255,247,236;...
255,242,224;...
254,237,212;...
254,232,200;...
253,222,179;...
253,212,158;...
253,200,145;...
253,187,132;...
252,141,89;...
239,101,72;...
215,48,31;...
179,0,0;...
127,0,0] / 255;
colors = flipud(colors);
stepSize = 500;
CMap = zeros((size(colors,1)-1)*stepSize, 3);
for i = 1:size(colors,1)-1
c1 = colors(i,:);
c2 = colors(i+1,:);
CMap((i-1)*stepSize+1:i*stepSize, 1) = linspace(c1(1),c2(1),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 2) = linspace(c1(2),c2(2),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 3) = linspace(c1(3),c2(3),stepSize);
end
elseif strcmp(type,'gray')
temp = linspace(255,0,11);
colors = [temp', temp', temp'] / 255;
stepSize = 500;
CMap = zeros((size(colors,1)-1)*stepSize, 3);
for i = 1:size(colors,1)-1
c1 = colors(i,:);
c2 = colors(i+1,:);
CMap((i-1)*stepSize+1:i*stepSize, 1) = linspace(c1(1),c2(1),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 2) = linspace(c1(2),c2(2),stepSize);
CMap((i-1)*stepSize+1:i*stepSize, 3) = linspace(c1(3),c2(3),stepSize);
end
end