Commit aa59842c authored by Jesse Heckman's avatar Jesse Heckman

updated color selction for plotting

parent 6fbf8368
......@@ -45,14 +45,14 @@ function RGB = pb_LCH2RGB(LCH)
% Matrix multiplication: C(i,j) = A(i,p)*B(p,j);
% https://en.wikipedia.org/wiki/CIE_1931_color_space
% http://en.wikipedia.org/wiki/SRGB
T = [3.2406, -1.5372, -0.4986;...
-0.9689, 1.8758, 0.0415;...
0.0557, -0.2040, 1.0570];
T = [3.2406, -1.5372, -0.4986; ...
-0.9689, 1.8758, 0.0415; ...
0.0557, -0.2040, 1.0570];
RGB = XYZ*T';
%% Gamma correction to convert RGB to sRGB
sel = RGB>0.0031308; % colorspace: 0.0031306684425005883
RGB(sel) = 1.055*(RGB(sel).^(1/2.4))-0.055;
RGB(sel) = 1.055*(RGB(sel).^(1/2.4))-0.055;
RGB(~sel) = 12.92*RGB(~sel);
%% Final check
......@@ -63,14 +63,9 @@ function RGB = pb_LCH2RGB(LCH)
%% Clip values
sel = RGB>1;
RGB(sel) = 1;
RGB(sel) = 1;
sel = RGB<0;
RGB(sel) = 0;
RGB(sel) = 0;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
......
function pb_showStatColor(varargin)
% PB_SHOWSTATCOLOR(varargin)
%
% PB_SHOWSTATCOLOR(varargin) displays all color schemes of statcolor.
%
% See also PB_SELECTCOLOR, PB_STATCOLOR.
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
fig = pb_keyval('fig', varargin, 99);
ncol = pb_keyval('col', varargin, 10);
ndef = pb_keyval('def', varargin, 15);
if ndef > 15; ndef = 15; end
figure(fig); clf;
list = zeros(ndef,ncol,3);
for i = 1:ndef
RGB = pb_statcolor(ncol,[],[],[],'def',i);
[m,n] = size(RGB);
RGB = reshape(RGB,1,m,n);
list(i,:,:) = RGB;
end
image(list);
ylabel('Definition');
xlabel('Color');
yticks(1:1:15);
end
\ No newline at end of file
......@@ -74,21 +74,42 @@ function Col = pb_statcolor(ncol,statmap,palette,Par,varargin)
Par = [0 100 100 20]; % [Lmin Lmax Cmax H]
case 7
statmap = 'sequential';
palette = 'luminancechromahue';
Par = [0 100 100 100 30 90]; % [Lmin Lmax Cmin Cmax H1 H2] % Heat
palette = 'luminancechroma';
Par = [0 100 100 80]; % [Lmin Lmax Cmax H]
case 8
statmap = 'diverging';
palette = [];
Par = [10 100 100 260 30]; % [Lmin Lmax Cmax H1 H2] 'Blue-White-Red'
%Par = [40 100 90 140 320]; % [Lmin Lmax Cmax H1 H2] 'Green-White-Purple'
statmap = 'sequential';
palette = 'luminancechroma';
Par = [0 100 50 140]; % [Lmin Lmax Cmax H]
case 9
statmap = 'sequential';
palette = 'luminancechromahue';
Par = [70 70 70 70 0 360]; % [Lmin Lmax Cmin Cmax H1 H2] %Rainbow
palette = 'luminancechroma';
Par = [0 100 50 260]; % [Lmin Lmax Cmax H]
case 10
statmap = 'sequential';
palette = 'luminancechromahue';
Par = [0 100 100 75 -20 90]; % [Lmin Lmax Cmin Cmax H1 H2] % Heat
case 11
statmap = 'diverging';
palette = [];
Par = [10 100 100 260 140]; % [Lmin Lmax Cmax H1 H2] 'Blue-White-Red'
case 12
statmap = 'diverging';
palette = [];
Par = [10 100 100 260 30]; % [Lmin Lmax Cmax H1 H2] 'Blue-White-Red'
case 13
statmap = 'diverging';
Par = [40 100 90 140 320]; % [Lmin Lmax Cmax H1 H2] 'Green-White-Purple'
case 14
statmap = 'divergingskew';
palette = [];
Par = [00 100 100 260 30]; % [Lmin Lmax Cmax H1 H2] 'Blue-White-Red'
case 15
statmap = 'sequential';
palette = 'luminancechromahue';
Par = [70 70 70 70 0 360]; % [Lmin Lmax Cmin Cmax H1 H2] %Rainbow
otherwise
statmap = 'qualitative';
palette = 'dynamic';
end
statmap = lower(statmap);
......@@ -193,9 +214,9 @@ function Col = pb_statcolor(ncol,statmap,palette,Par,varargin)
end
Col = pb_LCH2RGB(LCH);
if dispFlag
figure();
figure(99); clf;
plotcolmap(Col);
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment