% this is a duplicate of wrapitup2.m except it shrinks the image ouput for the .eps file

  close all
  degperinch = degperinch * 3; % change 

  fig_xleft_in=.1;
  fig_ybot_in=.1;
  fig_width_in=1.3*(diff(lonrange)/degperinch);  %make it bigger than axes
  fig_height_in=1.3*(diff(latrange)/degperinch);
  fig_position=[fig_xleft_in fig_ybot_in fig_width_in fig_height_in];

  ax_width_in=(diff(lonrange)/degperinch);
  ax_height_in=(diff(latrange)/degperinch);
  ax_xleft_in=max(.4,.1*ax_width_in); %shift the axes right from bot left corner
  ax_ybot_in=max(.4,.1*ax_height_in); %shift the axes up from bot left corner
  ax_position=[ax_xleft_in ax_ybot_in ax_width_in ax_height_in];

  paper_xleft_in=.2;  %0;
  paper_ybot_in= .2; %3-(2*ax_ybot_in+ax_height_in)-1; %11-(2*ax_ybot_in+ax_height_in)-1;
  paper_width_in= 8.5; %3.; %8.5;  %diff(lonrange)/degperinch;
  paper_height_in= 11.; %3.; %11; %diff(latrange)/degperinch;
  %paperposition=[paper_xleft_in paper_ybot_in paper_width_in paper_height_in];
  paperposition=[paper_xleft_in 8.5 paper_width_in paper_height_in];
  
  %now use figure(2) to draw the accumulated sections in correct dpi
  figure(2);clf  
  set(gcf,'units','inches')
  set(gcf,'Position',[fig_xleft_in fig_ybot_in fig_width_in fig_height_in])
  set(gcf,'PaperUnits','inches')
  set(gcf,'paperposition',paperposition)
  set(gcf,'PaperPositionMode','manual')
  set(gcf,'PaperOrientation','portrait')

  f1;clf
  [c,h]=contour6(top_lon,top_lat,topog,[-4000 -2000 -1000]);
  axes1=gca;
  hold on
  [bs,es,levs]=clines(c);
  for linei=1:length(levs)  
    h=plot(c(1,bs(linei):es(linei)),c(2,bs(linei):es(linei)),'k');
    set(h,'color',[1 1 1]*abs(levs(linei))/5000)
  end

  plot(x,y,'k');grid on
  axis('equal')
  axis([lonrange latrange])
 % lltick(gca,'x','lon','y','lat'); change
  lltick(gca,'x','none','y','none');

  if (exist('sect_info'))
    for sectjj=1:length(sect_info)
      sect_color=sect_colors(~(sect_colors==sect_color)); %i.e. switch colors
      iii=sect_info(sectjj).ii;
      h=plot(x(iii(1):iii(2)),y(iii(1):iii(2)),sect_color);lw(h,2)
      xytext=sect_info(sectjj).xytext;
      h=text(xytext(1),xytext(2),sect_info(sectjj).name);
      set(h,'color',sect_color);set(h,'fontsize',fontsize-5) % -5 on font
    end
  end

  xytext=NaN*ones(length(sect_info),2);
  for ii=1:length(xytext(:,1))
	xytext(ii,:)=sect_info(ii).xytext;
  end
  title(cruise_name);

  grid on
  orient portrait
  set(axes1,'parent',2)
  close(1)
  figure(2)
  set(gca,'Units','inches')
  set(gca,'Position',ax_position)
  set(gca,'xlim',lonrange,'ylim',latrange)
  set(gcf,'Position',fig_position)
  set(gcf,'PaperUnits','inches')
  set(gcf,'paperposition',paperposition)
  set(gcf,'PaperPositionMode','manual')
  set(gcf,'PaperOrientation','portrait')
  
  % fix x-axis label at last moment
  m_proj('merc');
  m_coast('patch',[0.6 .1 .3]);  %no effect
  xls = get(gca,'xticklabel');
  for xn = 2:2:length(xls)
     xls(xn) = {' '};
  end; 
  for qq = 1:length(xls)
     astr = xls{qq};
     degreesign = astr(end);
     astr = astr(1:end-1);   
     anumber = str2num(astr);
     if anumber > 180 & anumber < 360 % fix for longitudes > 180 for axis labels
        anumber = anumber - 360;
        astr = num2str(anumber);
        astr = [astr degreesign];
        xls{qq} = astr;
     end
  end
  set(gca,'xticklabel',xls);
  
  %print -depsc 'nav.eps';
  print -depsc 'mini_nav.eps';  % change 
  iconvert('mini_nav','eps','png')

  degperinch = degperinch/3; % change; re-establishes just for record 
