Home > chronux_2_00 > spikesort > utility > graphicstyles > tintmap.m

tintmap

PURPOSE ^

TINTMAP Tinted monochrome color map.

SYNOPSIS ^

function cmap = tintmap(tint, M)

DESCRIPTION ^

TINTMAP           Tinted monochrome color map.
   CMAP = TINTMAP(TINT, M), where TINT is a 1-by-3 RGB vector, returns an
   M-by-3 matrix containing a monochromatic color map based on the color
   TINT.

   CMAP = TINTMAP(TINT) uses the length of the colormap in the current
   figure for M.
   
   The tinted colormap is made combining the hue and saturation of the
   color described by TINT with a linear brightness gradient.  A gamma
   correction of +0.66 is then applied to the resulting rgb colormap.

   See also COLORMAP, GRAY.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cmap = tintmap(tint, M)
0002 %TINTMAP           Tinted monochrome color map.
0003 %   CMAP = TINTMAP(TINT, M), where TINT is a 1-by-3 RGB vector, returns an
0004 %   M-by-3 matrix containing a monochromatic color map based on the color
0005 %   TINT.
0006 %
0007 %   CMAP = TINTMAP(TINT) uses the length of the colormap in the current
0008 %   figure for M.
0009 %
0010 %   The tinted colormap is made combining the hue and saturation of the
0011 %   color described by TINT with a linear brightness gradient.  A gamma
0012 %   correction of +0.66 is then applied to the resulting rgb colormap.
0013 %
0014 %   See also COLORMAP, GRAY.
0015 
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%% Parse Inputs %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 if (nargin < 2),  M = size(colormap, 1);  end;
0018 if (length(tint)~=3 || isvectord(tint)~=2 || ~all(tint>=0.0 & tint<=1.0))
0019     error('TINT must be a 1-by-3 RGB vector with values between 0 and 1.');
0020 end
0021 
0022 %%%%%%%%%%%%%%%%%%%%%%%% Add tint via HSV space %%%%%%%%%%%%%%%%%%%%%%
0023 % use hue, sat from TINT w/ gamma-corrected brightness gradient
0024 tint_hsv = repmat(rgb2hsv(tint), M, 1);
0025 tint_hsv(:,3) = linspace(0,1,M)';
0026 cmap = hsv2rgb(tint_hsv).^(2/3);

Generated on Fri 15-Aug-2008 11:35:42 by m2html © 2003