function plotnav

%editglob
global DAYS LON LAT PMIN PMAX


t = DAYS(PMIN:PMAX);
lon = LON(PMIN:PMAX);
lat = LAT(PMIN:PMAX);

min_t  = min(t);
max_t  = max(t);
if min_t == max_t   % case of single profile in workspace
  min_t = min_t-0.5;
  max_t = max_t+0.5;
end
igood  = find(~isnan(lon));
if isempty(igood)
  disp('No good longitude/latitude data')
  return
end
minlat = floor(min(lat(igood)));
minlon = floor(min(lon(igood)));
dy = max(abs(ceil(max(lat(igood))) - minlat), abs(ceil(max(lon(igood))) - minlon));

clf
subplot(211)
plot(t, lon, '+')
axis([min_t max_t minlon minlon+dy])
grid
xlabel('decimal days')
ylabel('longitude')

subplot(212)
plot(t, lat, '+')
axis([min_t max_t minlat minlat+dy])
grid
ylabel('latitude')

