Home > NoiseTools > nt_linecolors.m

nt_linecolors

PURPOSE ^

nt_colorlines(h,permutation) - apply different colors to lines of plot

SYNOPSIS ^

function nt_colorlines(h,permutation)

DESCRIPTION ^

nt_colorlines(h,permutation) - apply different colors to lines of plot

  h: handle to plot (default:gca)
  permute: permutation to apply to colors

 Colors are applied to children of h in reverse order (ie in order of plot
 commands).  May produce unexpected results if there are childern other
 than plot lines.\
 
 NoiseTools
 See nt_stylelines, nt_widthlines.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function nt_colorlines(h,permutation)
0002 %nt_colorlines(h,permutation) - apply different colors to lines of plot
0003 %
0004 %  h: handle to plot (default:gca)
0005 %  permute: permutation to apply to colors
0006 %
0007 % Colors are applied to children of h in reverse order (ie in order of plot
0008 % commands).  May produce unexpected results if there are childern other
0009 % than plot lines.\
0010 %
0011 % NoiseTools
0012 % See nt_stylelines, nt_widthlines.
0013 
0014 if nargin<1 || isempty(h); h=gca; end
0015 if nargin<2; permutation=[]; end
0016 
0017 colororder=get(h,'colororder');
0018 if ~isempty(permutation); 
0019     colororder=colororder(permutation,:);
0020 end
0021 c=get(h,'children');
0022 
0023 for k=1:numel(c);
0024     set(c(numel(c)-k+1),'color',colororder(1+mod(k-1,size(colororder,1)),:))
0025 end
0026

Generated on Sat 29-Apr-2023 17:15:46 by m2html © 2005