function adcpcal2(calr, label, igood, j_t, j_ph, j_amp, j_dt);

% 98/01/28 replaced "pause" with "paused" Jules
% 2001/01/09 incompatible with matlab 12 (R6) - combining with adcpcal.m
%    make separate figures and have no pause (so we can run it from perl)

% --> Time series of raw amp and phase

figure
orient tall
axes('position',[.2 .75 .65 .17])
plot(calr(:, j_t), calr(:, j_ph), 'o')
xlabel('days')
ylabel('phase')
[m n] = size(calr);
title([label, ' unedited, npts = ' int2str(m)])
grid
axes('position',[.2 .53 .65 .17])
plot(calr(:, j_t), calr(:, j_amp), '+')
set(gca, xtl_str, [''])
ylabel('amplitude')
grid

% --> Time series of edited amp and phase: save
axes('position',[.2 .31 .65 .17])
   plot(calr(igood, j_t), calr(igood, j_ph), 'o')
   xlabel('days')
   ylabel('phase')
   title([label, ' edited, npts = ' int2str(length(igood))])
   grid
axes('position',[.2 .09 .65 .17])
   plot(calr(igood, j_t), calr(igood, j_amp), '+')
   set(gca, xtl_str, [''])
   ylabel('amplitude')
   text(-0.25, -0.35, pctime, 'units', 'normalized', 'rotation', 90.0);
   grid

print cal1.ps
fprintf('figure saved as cal1.ps\n\n')

% --> Histograms of edited amp and phase: save
figure
axes('position',[.2 .75 .65 .17])
   hist(calr(igood,j_ph), 20)
   title([label, ' edited, npts = ' int2str(length(igood))])
   xlabel('phase')
   set(gca, 'ygrid', 'on')
axes('position',[.2 .53 .65 .17])
   hist(calr(igood,j_amp), 20)
   set(gca, 'ygrid', 'on')
   xlabel('amplitude')

% --> Time series and histogram of time shift.

tx = calr(igood, j_t);
dty = calr(igood, j_dt);
axes('position',[.2 .31 .65 .17])
   plot(calr(igood, j_t), calr(igood, j_dt), '+')
   xlabel('days')
   ylabel('time: nav - pc')
   grid
axes('position',[.2 .09 .65 .17])
   hist(calr(igood,j_dt), 20)
   set(gca, 'ygrid', 'on')
   xlabel('time: nav - pc')
   text(-0.25, -0.35, pctime, 'units', 'normalized', 'rotation', 90.0);

print cal2.ps
fprintf('figure saved as cal2.ps\n\n')

