Home > data-vis > supporting_functions > set_colors.m

set_colors

PURPOSE ^

SYNOPSIS ^

function colors = set_colors(n)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function colors = set_colors(n)
0002 
0003 if exist('n', 'var') && ~isempty(n)
0004     if numel(n) == 1
0005         colors = ones(n,3);
0006         for i = 1 : n
0007             fprintf('set color for category %d\n', i);
0008             colors(i,:) = uisetcolor();
0009         end
0010     elseif size(n,2) == 3
0011         colors = n;
0012     end
0013 else
0014     colors = [
0015         0         0    1.0000
0016         0    1.0000         0
0017         1.0000         0         0
0018         1.0000         0    1.0000
0019         1.0000    1.0000         0
0020         0    1.0000    1.0000
0021         0.5020         0    1.0000
0022         1.0000         0    0.5020
0023         1.0000    0.5020         0
0024         0.8392    0.8392    0.8392
0025         0.8275    0.8510    1.0000
0026         0.7804    1.0000    0.9922
0027         0.8157    1.0000    0.8314
0028         1.0000    0.8588    0.8314
0029         0.3451    0.8824    0.8824
0030         0.7373    0.2941    0.7725
0031         0.4118    0.7765    0.6510
0032         0.9412    0.9608    0.5725
0033         0.6784    0.8078    0.5922
0034         0.3059    0.5451    0.7137
0035         0.5255    0.3098    0.9255
0036         0.8392    0.3804    0.5725
0037         0.3451    0.1216    0.3882
0038         0.4235    0.4745    0.3216
0039         0.1725    0.3333    0.3294
0040         0.2784    0.2824    0.4824
0041         0.0745    0.5804    0.1529
0042         ];
0043     colors = repmat(colors, 10,1);
0044 end
0045 
0046 end

Generated on Tue 23-May-2017 03:00:58 by m2html © 2005