Thursday, May 5, 2016

Colormap Stark #matlab colorbar

I wanted to have a colormap which had a great degree of contrast, and was not really a rainbow scheme.

I have tried to solve this issue by poking at different colormaps
http://usefulcodes.blogspot.com/2015/06/colormap-hotjet.html
(very close, but keeps the rainbow defect flat intensity for the large part in the middle.)
http://usefulcodes.blogspot.com/2015/06/colormap-goofy-matlab.html
(looks green and goofy! Did not like it.)
http://usefulcodes.blogspot.com/2015/06/matlab-colormap-rose.html
(has nice monotonic intensity gradient, but not that beautiful on maps.)
See the examples: http://usefulcodes.blogspot.com/search/label/colormap
I present you a new one! Colormap "stark".
This does have the defect of not linearly increasing the intensity, but does not stay flat in the middle. It has two saddles, allowing the left/right contrast. I like it so far.
Well, it is inspired from the LST image from MODIS
http://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD11C1_M_LSTDA


175 256 255
100 249 255
50 223 253
10 191 252
9 144 252
12 106 255
11 79 254
26 56 254
34 38 255
50 34 255
79 33 255
85 33 255
101 34 255
132 35 255
150 36 255
177 39 255
217 36 255
243 35 255
255 35 213
255 34 175
255 30 143
255 36 110
255 34 88
255 33 65
255 44 35
255 72 35
254 95 39
255 116 45
254 138 41
254 160 46
255 183 45
255 199 46
255 210 47
253 225 47
254 230 75
256 256 110
R G B





newN = 1:64;

isn = floor(linspace(1,64,36));
%RGB = [R G B];
R1 = RGB(:,1);
G1 = RGB(:,2);
B1 = RGB(:,3);

Rn = runmean(interp1(isn, R1, newN),2);
Gn = runmean(interp1(isn, G1, newN),2);
Bn = runmean(interp1(isn, B1, newN),2);

newC=  [Rn', Gn', Bn']./256;


close all
figure ;
plot(newN, Rn, 'r-')
hold on
plot(newN, Gn, 'G-')
plot(newN, Bn, 'b-')
colormap(newC);
colorbar('southoutside')
ylim([0 260])
xlim([1 64])
legend('R', 'G', 'B','Location','southoutside','Orientation','horizontal')
xlabel('C-index')
ylabel('R,G,B')
export_fig([ 'RGB-colormap'   ],'-jpeg','-r250')

figure;
plot(newN, sum(newC,2)./3, 'r-')
ylabel('Intensity')
xlabel('C-index')
xlim([1 64])
export_fig([ 'RGB-intensity' ],'-jpeg','-r250')

Here is an alternate
175 256 255
100 249 255
50 223 253
10 191 252
9 144 252
12 106 255
11 79 254
26 56 254
34 38 255
50 25 255
79 15 255
85 15 255
101 30 255
132 50 255
150 70 255
177 80 255
217 100 255
243 100 255
255 80 213
255 70 175
255 50 143
255 30 110
255 15 88
255 25 65
255 44 35
255 72 35
254 95 39
255 116 45
254 138 41
254 160 46
255 183 45
255 199 46
255 225 47
253 240 47
254 250 75
256 256 129
R G B

It adds whiteness in the middle, creating W shaped swing to the green pallets.





No comments: