Documentation of color_under


Global Index (short | long) | Local contents | Local Index (short | long)


Function Synopsis

h = color_under(lat, lon, data, levels, pm);

Help text


  h = color_under(lat, lon, data, levels, pm)

  This program shades the values of data that are greater
  or less than the minimum level given in 'levels',
  depending on 'pm'.


  lat = latitude vector
  lon = longitude vector
  data = data to shade
  levels = contour levels (one per shade of red or blue).
  pm = either a '+' or a '-'.  If +, it will shade values
       greater than those given in 'levels', if '-', it
       will shade values less than those in 'levels'.


Cross-Reference Information

This function calls This function is called by

Listing of function color_under

function h = color_under(lat, lon, data, levels, pm);
  
%  Dan Vimont, 2/15/2001
  
  %  Set up defaults
  
  if nargin < 5;
    error('Unfortunately, this program needs all five inputs.');
  end
  
  if ~ismap(gca); error('This program works only for map axes.'); end
  
  [msg, x, y, z, c] = xyzchk(lon, lat, data);
  
  if ~isempty(msg); error(msg); end;
  
  global XAX YAX FRAME
  XAX = lon; YAX = lat;
  FRAME = [getm(gca, 'maplonlimit') getm(gca, 'maplatlimit')];
  
  %  Set up levels
  
  if strcmp(pm, '+');
    tem = data;
    lev = levels;
    nlev = sum(lev < max(max(tem)));
    colr = flipud([ones(nlev, 1) [0:0.8/(nlev-1):0.8]' ...
		    [0:0.8/(nlev-1):0.8]']);
  elseif strcmp(pm, '-');
    tem = -data;
    lev = -levels;
    nlev = sum(lev < max(max(tem)));
    colr = flipud([[0:0.8/(nlev-1):0.8]' ...
		    [0:0.8/(nlev-1):0.8]' ones(nlev, 1)]);
  else
    error('pm must be either ''+'' or ''-''.');
  end
  
  for i = nlev:-1:1;
    color_shadem2(tem, lev(i), colr(i,:));
  end