Home > atmlab > graphs > colorset.m

colorset

PURPOSE ^

COLORSET Gives a datalevel the specified color

SYNOPSIS ^

function colorset(x,c)

DESCRIPTION ^

 COLORSET   Gives a datalevel the specified color

    The range around value *x* is given the color *c*. The size of the
    range depends on the color axis scaling and the number of levels in the
    color map. The colored range follows the way Matlab sets the colers,
    and the range is most likely not centred around *x*. If *x* is exactly
    at the limit between two color ranges, both ranges are set to *c*.

 FORMAT   colorset(x[,c])
        
 IN    x   Data level to mark.
 OPT   c   Color. Default is white ([1 1 1]).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

colorset.m

SOURCE CODE ^

0001 % COLORSET   Gives a datalevel the specified color
0002 %
0003 %    The range around value *x* is given the color *c*. The size of the
0004 %    range depends on the color axis scaling and the number of levels in the
0005 %    color map. The colored range follows the way Matlab sets the colers,
0006 %    and the range is most likely not centred around *x*. If *x* is exactly
0007 %    at the limit between two color ranges, both ranges are set to *c*.
0008 %
0009 % FORMAT   colorset(x[,c])
0010 %
0011 % IN    x   Data level to mark.
0012 % OPT   c   Color. Default is white ([1 1 1]).
0013 
0014 % 2007-03-12   Created by Patrick Eriksson.
0015 
0016 
0017 function colorset(x,c)
0018   
0019 if nargin < 2
0020   c = [1 1 1];
0021 end
0022 
0023 
0024 [cranges,cmap] = colorspec;
0025 
0026 ind = find( x>=cranges(:,1)  &  x<=cranges(:,2) );
0027 
0028 for i = 1:length(ind)
0029 
0030   cmap(ind(i),:) = c;
0031   
0032 end
0033 
0034 colormap( cmap );

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005