Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)
[c, h] = map_contour(data, cint, usezero);
[c, h] = map_contour(data, cint, usezero);
data = map data
cint: if scalar, then it's the contour interval
if vector, then it's a vector of contours levels
usezero: 'zeroline', 'z', 'yes', 'y', or 1 will produce a zero line
'nozeroline', 'n', or 0 will produce no zero line
Default is 'nozeroline'
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, usezero);
% Dan Vimont, 2 September, 1999
if nargin < 3; usezero = 0; end;
if isstr(usezero);
if strcmp(lower(usezero(1)), 'z'); usezero = 1;
elseif strcmp(lower(usezero(1)), 'y'); usezero = 1;
elseif strcmp(lower(usezero(1)), 'n'); usezero = 0;
else
error('usezero must be either ''zeroline'', or ''nozeroline'' ');
end
else
if ~ismember([0 1], usezero);
error('zeroline must be 0 (nozeroline) or 1 (zeroline)')
end
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
% Set defaults
if nargin < 2; cint = (max(max(data))-min(min(data)))/10; end;
lab = 0;
line_style = 'k';
% 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)) ...
cint:cint:max(max(data2))]);
else
clev = cint;
end
if usezero; clev = sort([clev 0]); end
% Repeat the first and last elements of clev, so if there's only
% one positive or negative contour, it still works in pncontm.
% Otherwise, it interprets it as the number of contour intervals
% you want to use (see contourm).
clev = [clev(1) clev clev(end)];
% Plot the data
[c, h] = pncontm(XAX2, YAX2, data2, clev, lab, line_style);
set(gca, 'NextPlot', next_ax);