Documentation of mshade3


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


Function Synopsis

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

Help text


  [c, h] = mshade3(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 for stereo projections, or
  (Try typing 'maps' to see the style of the projection 
  you want to use).  It may work for anything mcolor.m works
  for, but I haven't tested it.

  The default mstyle is North Polar Stereographic ('stereo'), 
  centered at the north pole, and 270 degrees.  This should
  all be pretty easy to change, though.


Cross-Reference Information

This function calls This function is called by

Listing of function mshade3

function [c, h] = mshade3(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'));
if strcmp(next_ax, 'replace');  cla;  end;

%  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.

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

if isempty(find(~isnan(data2))); return; end;

%  Plot the data

%size(YAX2)
%size(XAX2)
%size(data2)

[m, n] = size(data2);
clev = [lev max(max(data2))+lev];
[c, h] = contourfm(YAX2, XAX2, data2, clev);
set(h, 'FaceColor', colr);

set(gca, 'NextPlot', next_ax);