File Exchange

image thumbnail

ColorBlindSets

version 1.0.0.0 (328 KB) by Massimo Ciacci
Helps you choose a palette of color blind friendly colors

2 Downloads

Updated 23 Nov 2017

View License

GETCOLORSET : Color Blind Friendly Color Sets
[ cMat, cStruct, cNames, colorCell] = getColorSet( NColors , PaletteSize, skipGray)
Helps you choose a palette of color blind friendly colors
The palette choice is such as to attempt best discriminability by a deuteranopus
color blind as long as PaletteSize(PaletteSize) <= 14
1) assigns colors to [cMat, cStruct]
2) sets defaultAxesColorOrder accordingly for use with hold all
3) Returns a list [ cNames, colorCel] of NColors,
where PaletteSize colors are repeated to fill up required NColors size
NColors : size(cMat,1) = numel(cNames) --> number of curves that will be plotted on top
PaletteSize : how many different colors are there

PaletteSize : 1..27
----------
<= 11 Color Blind Safe % SMALL
12..15 Color Blind okeish % MEDIUM
16..19 Color Blind challenging % LARGE
20..26 Color Blind unfriendly % Too Large

Four possible color addressing modes :
------------------------------------
(1) automatic
hold all; plot(..); Use defaultAxesColorOrder colors, set by this function

(2) cell Array
plot( ,'color', colorCell{idx}) Cell Array

(3) matrix row
plot(...,'color', cMat(idx,:)) Matrix Row

(4) struct name with color name field
plot(...,'color', cStruct.SpringGreen) Color Name

EXAMPLE, Using Defaults
=======
N = 15; %number of curves
[ cMat, cStruct] = getColorSet(); %use best defaults for color blind viewer
figure(123); hold all;
for idx = 1:N
plot([0,1],N+1-[idx,idx], 'linewidth',6)
end
EXAMPLE
=======
N = 10;
[ cMat, cStruct, cNames] = getColorSet(N);
figure(123); hold on;
for idx = 1:N
plot([0,1],[idx,idx],'color',colorCell{idx}, 'DisplayName',cNames{idx}, 'linewidth',6)
end
leg = legend(gca,'-DynamicLegend');
legend(gca,'show');

Cite As

Massimo Ciacci (2020). ColorBlindSets (https://www.mathworks.com/matlabcentral/fileexchange/65163-colorblindsets), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux