function set_linestyles() % % For the current figure, for each 'axes' within it, find % all lines and set in turn the markers and line-colours. % % Nathaniel, 2009-12-25. % % list of colours to cycle through (each line: RGB) % these are the matlab auto-defaults: 7 lines, then repeat: % found by: A=sort(a.Children);for n=1:numel(A), t=[t; get(A(n), 'Color')]; end; t C0 = [ ... 0.00 0.00 1.00 0.00 0.50 0.00 1.00 0.00 0.00 0.00 0.75 0.75 0.75 0.00 0.75 0.75 0.75 0.00 0.25 0.25 0.25 ]; % these colours correspond to 'bgrkm' C1 = [ ... 0.00 0.00 1.00 0.00 1.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 1.00 ]; % these are all the combinations of 0 or 1 other than 111(white) C2 = [ ... 1 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 1 0 0 0 1 ]; % an alternative set, chosen from colours in KDE's colour-chooser: that % returns values in html format, three hex numbers: here's the conversion: % for i=1:size(a,1), for j=1:size(a,2), e(i,j) = hex2dec(a{i,j})/255; end, end C3 = [ ... 0.18 0.07 0.86 0.22 0.77 0.06 0.90 0.08 0.12 0.73 0.60 0.05 0.72 0.09 0.74 0.04 0.73 0.64 ]; % choose which colour list to use C = C0; % list of markers to cycle through M = 's+dph'; % work on the current figure: get its properties f = get(gcf()); % for each child of the figure, for na = 1:numel(f.Children), % get details of this child-object: skip if not 'axes' object a = get(f.Children(na)); if ~strcmpi(a.Type,'axes'), continue; end % for each child of the axes, n = 0; L = sort(a.Children); for nl = 1:numel(L), % get details of this child: skip if not 'line' object l = L(nl); if ~strcmp(get(l,'Type'),'line'), continue; end n = n + 1; set(l, 'Color', C(mod(n-1,size(C,1))+1,:)); set(l, 'LineStyle', '-'); set(l, 'LineWidth', 0.5); set(l, 'Marker', M(mod(n-1,length(M))+1)); set(l, 'MarkerSize', 7); set(l, 'MarkerEdgeColor', 'auto'); set(l, 'MarkerFaceColor', 'none'); end end