ourMELONS/matlab/graph/giveColors.m
2019-12-16 16:47:21 +01:00

14 lines
641 B
Matlab

function [colors] = giveColors(n)
if n > 36
error('Maximum number of colors 36');
end
colors = [1 0 0; 0 1 0; 0 0 1; 1 1 0 ; 1 0 1; 0 1 1; ...
0.4 0 0; 0 0.4 0; 0 0 0.4; 0.4 0.4 0; 0.4 0 0.4; 0 0.4 0.4; ...
0.2 0 0; 0 0.2 0; 0 0 0.2; 0.2 0.2 0; 0.2 0 0.2; 0 0.2 0.2; ...
0.8 0 0; 0 0.8 0; 0 0 0.8; 0.8 0.8 0; 0.8 0 0.8; 0 0.8 0.8; ...
0.6 0 0; 0 0.6 0; 0 0 0.6; 0.6 0.6 0; 0.6 0 0.6; 0 0.6 0.6; ...
0.6 0.2 0.4; 0.2 0.4 0.8; 0.8 0.4 0.2; 0 0.6 0.2; 0.2 0.8 0.6; 0.5 0.2 0.1; ...
0.6 0.3 0.1];
colors = colors(1:n,:);
% red; green; blue; yellow
% RGB format: [red green blue]