Documentation of instructions


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


Help text

  Instructions for making contour plots in MATLAB

  This set of instructions uses routines that may be found in the
  directory:  ~dvimont/matlab/Wallace .  In order for MATLAB to
  find these files, either copy those files that you would like
  to use into your matlab directory (~/matlab), or redefine the
  'path' variable within MATLAB.  Execute the following command
  within MATLAB, or better yet, put it in your ~/matlab/startup.m
  file:

Cross-Reference Information

This script calls This script is called by

Listing of script instructions



path('/home/disk/tao/dvimont/matlab/Wallace',path);

%  To see what directories MATLAB will try to access, type 'path'
%  in MATLAB.

path

%  The next thing to do is to link to all of Alexis Lau's old scripts.
%  Most of our routines have grown out of his.  Again, it's better to
%  just add link_alexis_scripts to your startup.m file.

link_alexis_scripts

%  Now, clear your workspace, in that most of these variables are
%  global anyway.

clear

%  Let's start with some simple contour maps

%  Load pre-made regression maps:

load /home/disk/tao/dvimont/matlab/Wallace/CT_regmaps.mat

%  To see what variables we've loaded, type:

whos

%  Now, set up a figure window

figure_landscape(1);

%  Once a figure handle has been defined (see tutorial), next an axes
%  needs to be defined in the figure window.  This may be done with the
%  subplot routine, or through a modified subplot routine, like sp.m.
%  To add some confusion, sp.m uses global variables - variables that
%  may be used in the workspace AND in matlab routines (like sp.m).

%  Initialize global variabiles:

global_axes(8, 5, 0, 0, 1.5);
global_xy(lat, lon);

%  Set up an axes in the current figure window.

sp(1,1);  %  sp(ncol, thisPlot)

%  Now, define current limits of the plot

FRAME = [0 360 -90 90];  % FRAME = [minlon maxlon minlat maxlat];

%  And, set the current axes up as a map axes.

mapaxes('mollweid', [0 180]);

%  Let's start by contouring the CT regression map

contourm(lat, lon, regmap2, [-1:.1:1]);

%  Draw a map outline over the top

mapfill('over');
gridm on;

%  This is OK for quickly viewing a plot.  Here are some other ideas:

figure_landscape(1); clf;
sp(1,1); cla;
  maxes('mollweid', [0 200]);
  [c, h] = contourm(lat, lon, lm.*regmap2, [-1:.1:1], '-k');
  mapfill('over');
  gridm on;
  cl = clabelm(c, h, [-1:.2:1]);
  set(cl, 'fontsize', 8);
  
%  Or, better yet:

figure_landscape(1); clf;
sp(1,1); cla;
  maxes('mollweid', [0 200]);
  [c, h] = contorm(lat, lon, lm.*regmap2, [-1:.1:-.1], '--k');
  hold on;
    [c1, h1] = contorm(lat, lon, lm.*regmap2, [.1:.1:1], '-k');
    [c2, h2] = contorm(lat, lon, lm.*regmap2, [0 0], '-k');
    set(h2, 'linewidth', 2);
  hold off;
  mapfill('over');
  gridm on;

%  Note that there's a stripe through 0E where there is no data
%  (this is really subtle).  This can be redone with the help of
%  the global variables XAX3 and YAX3:

global_xy(lat, lon);
mapdat = lm.*regmap2;
mapdat = [mapdat mapdat(:,1)];

figure_landscape(1); clf;
sp(1,1); cla;
  maxes('mollweid', [0 200]);
  [c, h] = contorm(YAX3, XAX3, mapdat, [-1:.1:-.1], '--k');
  hold on;
    [c1, h1] = contorm(YAX3, XAX3, mapdat, [.1:.1:1], '-k');
    [c2, h2] = contorm(YAX3, XAX3, mapdat, [0 0], '-k');
    set(h2, 'linewidth', 2);
  hold off;
  mapfill('over');
  gridm on;

%  This can all be avoided by using a different routine:

global_xy(lat, lon); FRAME = [0 360 -90 90];

figure_landscape(1); clf;
sp(1,1); cla;
  mcont2(lm.*regmap2, 0.1, 'mollweid', 'nozeroline');
  mapfill('over');
  gridm on
  
%  OK!  Let's shade the data too.

mapdat = lm.*regmap2;
mapdat = [mapdat mapdat(:,1)];

figure_landscape(1); clf;
color_davet;
sp(1,1); cla;
  mapaxes('mollweid', [0 200]);
  hh = surfacem(YAX3, XAX3, mapdat);
  set(hh, 'Facecolor', 'flat');
  drawmapm
  gridm on
  squeeze_axes
  
  colorbar2('horiz');
  
om = isnan(lm);
om(~om)==NaN;

mapdat = om.*regmap2;
mapdat = [mapdat mapdat(:,1)];

figure_landscape(1); clf;
color_davet;
sp(1,1); cla;
  mapaxes('ortho', [0 15]);
  hh = surfacem(YAX3, XAX3, mapdat);
  set(hh, 'Facecolor', 'flat');
  drawmapm
  gridm on
  squeeze_axes
  
  colorbar2('horiz');