Documentation of mcolor4


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


Function Synopsis

[h1, h2] = mcolor4(data, mstyle, center);

Help text


  [h1, h2] = mcolor(data, mstyle, center);

  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.  

  center == 1 ==> colormap centered on 0 
  Otherwise, the colormap will fit the data (default).

  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.

  h1 = map axes handle
  h2 = surface handle


Cross-Reference Information

This function calls

Listing of function mcolor4

function [h1, h2] = mcolor4(data, mstyle, center);

%  Dan Vimont, 5 April, 2000

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; mstyle = 'mollweid'; end;
if nargin < 3; center = 0; 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;

%  Define map axis:

hh1 = axesm('mapprojection', mstyle, ...
      'maplatlimit', FRAME(3:4), ...
      'maplonlimit', FRAME(1:2));

%  Plot the data

hh2 = pcolorm(YAX*ones(1, length(XAX2)), ...
             ones(length(YAX), 1)*XAX2', ...
             data2);

axis_limits;

if center == 1;
  tem = (max(max(data2)) - min(min(data2)))/2;
  caxis([-tem tem]);
else
  caxis([min(min(data2)) max(max(data2))]);
end

if nargout == 1;
  h1 = hh1;
elseif nargout == 2;
  h1 = hh1;
  h2 = hh2;
end

set(gca, 'NextPlot', next_ax);