Home > SurfStat > spectral.m

spectral

PURPOSE ^

Black-purple-blue-green-yellow-red-white color map.

SYNOPSIS ^

function map = spectral( m );

DESCRIPTION ^

Black-purple-blue-green-yellow-red-white color map.

 Usage: map = spectral( m );

 m = number of colours; default is the length of the current colormap.

 map = m x 3 matrix containing a "spectral" colormap.
 
 E.g. colormap(spectral) resets the colormap of the current figure.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function map = spectral( m );
0002 
0003 %Black-purple-blue-green-yellow-red-white color map.
0004 %
0005 % Usage: map = spectral( m );
0006 %
0007 % m = number of colours; default is the length of the current colormap.
0008 %
0009 % map = m x 3 matrix containing a "spectral" colormap.
0010 %
0011 % E.g. colormap(spectral) resets the colormap of the current figure.
0012 
0013 if nargin < 1, m = size(get(gcf,'colormap'),1); end
0014 base = [
0015   0.2000 0.2000 0.2000
0016   0.4667 0.0000 0.5333
0017   0.5333 0.0000 0.6000
0018   0.0000 0.0000 0.6667
0019   0.0000 0.0000 0.8667
0020   0.0000 0.4667 0.8667
0021   0.0000 0.6000 0.8667
0022   0.0000 0.6667 0.6667
0023   0.0000 0.6667 0.5333
0024   0.0000 0.6000 0.0000
0025   0.0000 0.7333 0.0000
0026   0.0000 0.8667 0.0000
0027   0.0000 1.0000 0.0000
0028   0.7333 1.0000 0.0000
0029   0.9333 0.9333 0.0000
0030   1.0000 0.8000 0.0000
0031   1.0000 0.6000 0.0000
0032   1.0000 0.0000 0.0000
0033   0.8667 0.0000 0.0000
0034   0.8000 0.0000 0.0000
0035   0.8000 0.8000 0.8000
0036 ];
0037 n = length(base);
0038 X0 = linspace (1, n, m);
0039 map = interp1(1:n,base,X0);
0040 
0041 return

Generated on Fri 26-Sep-2008 14:05:29 by m2html © 2003