Documentation of mshade


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


Function Synopsis

[c, h] = mshade(data, lev, colr);

Help text


  mshade(data, lev, colr);

  This function uses the mapping toolbox to shade the
  input 'data' matrix.  It assumes that the x and y axes
  are defined in the global variables XAX and YAX, 
  respectively.

  Note that this function works best for cylindrical, or
  pseudocylindrical projections.  (Try typing 'maps' to 
  see the style of the projection you want to use).  It
  may work for others too, but I haven't tested it.

  The default mstyle is Global Isometric ('giso'), 
  centered at the center of the variable FRAME.  This should
  all be pretty easy to change, though.


Cross-Reference Information

This function calls

Listing of function mshade

function [c, h] = mshade(data, lev, colr);

%  Dan Vimont, 2 September, 1999

data = squeeze(data);
data(data < lev) = NaN;

%  First, determine if hold is 'on', or 'off'.

next_ax = lower(get(gca, 'NextPlot'));
set(gca, 'NextPlot', 'add');

%  Get the global varaibles XAX YAX and FRAME

global XAX YAX FRAME
if (size(XAX, 1) == 1); XAX = XAX'; end;
if (size(YAX, 1) == 1); YAX = YAX'; end;

[m, n] = size(data);
if or((m~=length(YAX)), (n~=length(XAX)));
  error('[length(YAX) length(XAX)] must equal size(data)');
end

%  Set defaults

if nargin < 3; colr = 0.55*[1 1 1]; end;
if isscalar(colr); colr = colr*[1 1 1]; end;

%  Redefine XAX, YAX and data for global contouring -- allowing 
%  for wrapping around the globe.

if (FRAME(2) - FRAME(1) == 360);
  data2 = [data data(:,1)];
  XAX2 = [XAX; XAX(1)+360];
else
  data2 = data;
  XAX2 = XAX;
end;

%  Plot the data

clev = sort([lev max(max(data2))+lev]);
[c, h] = contourfm(YAX, XAX2, data2, clev);
set(h, 'FaceColor', colr);

set(gca, 'NextPlot', next_ax);