function show(var, plot_title, xlab, offset)
%
% plots var against depth bin if var is u, v, w, pg or amp
% plots longitude against latitude if var is [nav; lonlat].
% For var = u, v, w, pg or amp, xlab must be specified for
% labeling the x-axis properly; an offset may be provided
% to 'stagger' the profile plots.

if (nargin < 4)
  offset = 0;
end
if (nargin < 3)            % no xlab = must be plotting navigation 
  plot(var(1,:), var(2,:), '*', var(3,:), var(4,:))
  axis('equal')
  xlabel('Longitude');
  ylabel('Latitude');
  title('Cruise Track');
  grid
else
  [nr nc] = size(var);
  ofs     = ones(nr,1) * [0:(nc-1)] * offset;
  if (nc > 5)              % don't plot offset lines--too messy
    plot(var+ofs, -[1:nr])
  else
    plot(var+ofs, -[1:nr], ofs, -[1:nr])
  end
  if (~isempty(xlab))  % don't put ylabel if no xlabel
    ylabel('Depth Bin');
  else
    set(gca, 'YTickLabel', [''])
  end
  if (offset ~= 0) % drop label on last tick mark
    xtick = get(gca, 'xtick');
    xtick(length(xtick)) = [];
    set(gca, 'xtick', xtick) 
    set(gca, 'ygrid', 'on');
  else
    grid
  end
  xlabel([xlab ' offset = ' num2str(offset)]);
  title(plot_title)
end

