ColorBlindSets

Helps you choose a palette of color blind friendly colors
237 téléchargements
Mise à jour 23 nov. 2017

Afficher la licence

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');

Citation pour cette source

Massimo Ciacci (2024). ColorBlindSets (https://www.mathworks.com/matlabcentral/fileexchange/65163-colorblindsets), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2014b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
1.0.0.0