ColorBlindSets

版本 1.0.0.0 (327.8 KB) 作者: Massimo Ciacci
Helps you choose a palette of color blind friendly colors
252.0 次下载
更新时间 2017/11/23

查看许可证

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

引用格式

Massimo Ciacci (2025). ColorBlindSets (https://www.mathworks.com/matlabcentral/fileexchange/65163-colorblindsets), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2014b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0