function c = xred_yellow_white(m)
%XRED_YELLOW_WHITE a color spectrum from red-yellow-white.
%	XRED_YELLOW_WHITE(M) returns an M-by-3 matrix containing a
%	red yellow white colormap.
%	XRED_YELLOW_WHITE, by itself, is the same length as the current colormap.
%
%	For example, to reset the colormap of the current figure:
%
%	          colormap(xred_yellow_white)
%
%	See also HSV, HOT, COOL, BONE, COPPER, PINK, FLAG, 
%	COLORMAP, RGBPLOT.

%     Copyright J. V. Mansbridge, CSIRO, Tue Aug  2 11:15:23 EST 1994

% a 32 color spectrum from red-yellow-white                       

x = [
   95,   0,   0,   111,   0,   0,   127,   0,   0,   143,   0,   0,
  159,   0,   0,   175,   0,   0,   191,   0,   0,   207,   0,   0,
  223,   0,   0,   239,   0,   0,   255,   0,   0,   255,  23,   0,
  255,  46,   0,   255,  69,   0,   255,  92,   0,   255, 115,   0,
  255, 138,   0,   255, 161,   0,   255, 184,   0,   255, 207,   0,
  255, 230,   0,   255, 255,   0,   255, 255,  25,   255, 255,  51,
  255, 255,  76,   255, 255, 102,   255, 255, 127,   255, 255, 153,
  255, 255, 178,   255, 255, 204,   255, 255, 229,   255, 255, 255
];

x = reshape(x'/255, 96, 1);
if nargin < 1, m = size(get(gcf,'colormap'),1); end
mm = m - 1;
x_32 = (0:31)/31;
x_m = (0:mm)/mm;
r = interp1(x_32, x(1:3:94), x_m);
g = interp1(x_32, x(2:3:95), x_m);
b = interp1(x_32, x(3:3:96), x_m);
c = [ r g b ];
