function h = pmc(option,varargin)
% Plot MAB Coastline (Mid-Atlantic Bight)
% han = pmc(options...)
%   option = a colorspec to specify coastline color
%   option = 'fill' fills land
%        additional options give color of land then coast
%          
% Data are nominally 1:250000 World Vector Coastline from NGDC 
% coastline extractor web site. The vector file was modified to
% allow filling using routine fillseg
% John Wilkin jwilkin@rutgers.edu
%
% Example usage:
% pmc('fill')      grey land (default), black coast (default)
% pmc('fill','r')  red land, black coast(default)
% pmc('fill','r','b')  red land, blue coast
% pmc('fill',[r g b],[r g b]) 
% pmc              black coast default (no land fill)
% pmc('r')         red coast (no land fill) 



% get plot state
nextplotstatewas = get(gca,'nextplot');

% hold whatever is already plotted
set(gca,'nextplot','add')

if exist('muricoast.mat')~=2
  error('The coastline data file muricoast.mat is not in the path')
else
  load muricoast
end

if nargin == 0
  han = plot(lon,lat,'k'); 
else
  if isstr(option)
    if strcmp(option,'fill')
      land = 0.8*[1 1 1];
      edge = [0 0 0];
      if length(varargin)> 0
        land = varargin{1};
      end
      if length(varargin)> 1
        edge = varargin{2};
      end
      han = fillseg(c,land,edge);
    else
      % option is a colorspec vector for the coast color
      edge = option;
      land = 0;
    end
  else
    edge = option;
    land = 0;
  end
  if ~land
    han = plot(lon,lat,'-');
    set(han,'color',edge)
  end
end

% restore nextplotstate to what it was
set(gca,'nextplot',nextplotstatewas);

if nargout > 0
  h = han;
end
