Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)
[c, h] = map_contour(data, cint, line_style);
[c, h] = map_contour(data, cint, line_style);
data = map data
cint: if scalar, then it's the contour interval
if vector, then it's a vector of contours levels
line_style = common line styles (see plot)
This function uses the mapping toolbox to contour the
input 'data' matrix. It assumes that the x and y axes
are defined in the global variables XAX and YAX,
respectively.
| This function calls | This function is called by |
|---|---|
function [c, h] = map_contour(data, cint, line_style);
% Dan Vimont, 2 September, 1999
if nargin < 3; line_style = '-k'; end;
if nargin < 2; cint = (max(max(data))-min(min(data)))/10; end;
data = squeeze(data);
% 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
% 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);
% Define contour interval;
if isscalar(cint);
clev = sort([-cint:-cint:min(min(data2)) ...
0:cint:max(max(data2))]);
else
clev = cint;
end
% Plot the data
ver = version;
if strcmp(ver(1), '6');
[c, h] = contourm(YAX2, XAX2, data2, clev, line_style);
elseif strcmp(ver(1), '5');
[c, h] = contorm(YAX2, XAX2, data2, clev, line_style);
end;
set(gca, 'NextPlot', next_ax);