% plotfig.m  (called by peter_new.m)
%find zero values of volume backscattering and set equal to 1.01e-10
dd=0;
if dd==0
    lerow=length(emat(1,:))-7;
numrow=length(emat(:,1));
tmpcol=reshape(emat(:,8:length(emat(1,:))),lerow*numrow,1);
ifnd=find(tmpcol(:,1)==0);
te=ones(size(ifnd)).*(1.01e-10);
 if ifnd >0 
    tmpcol(ifnd,1)=te;
 end
 emat(:,8:length(emat(1,:))) = reshape(tmpcol,numrow,lerow);
end
%end find routine

    
img = emat(:,8:407)';
img = 10*log10(img);


xaxlab = emat(1:max(r),1);

% Compute width of plot
trandist = emat(1:length(emat(:,1)),1); %trandist = time in unit steps
  labelx='Time (year day)';
  mintime=min(emat(:,1));
  maxtime=max(emat(:,1));
  elapsetime=(maxtime-mintime)*24*60; % time of transect in minutes
  tscale=elapsetime/(24*60); % elapsetime in min divided by minutes in a day
  %scale horizontal axis of plot when plotting distance as time
width=((max(trandist)-min(trandist))/tscale)*.87;
%%%end 


depthint= emat(1,7);
yint=400;

height=(yint*depthint/maxdepth)*step-.05; % scale height of plot


set(gcf,'units','normalized');

plax(ic)=axes('position', [left bottom .85*width height]);
set(gca,'drawmode','fast');

%%%%subplot(4,1,1)
clim=[-100 -40];
imagesc(xaxlab,yaxlab,img,clim);


