try
close(inst_plot);
catch
    fprintf('Already closed');
end

inst_plot=figure;
set(inst_plot,'name','GASHOUND STATS');

t=get(Dhand.Time_Select,'value');
    switch t,
     case 1
        t=1;
      case 2
        t=3;
     case 3
        t=7;
     case 4
        t=100000; 
    end % switch
 
tind=find(Drift.gashound(1,:)>=falsenow-t);
subplot(2,2,1);
plot(Drift.gashound(1,tind),(Drift.gashound(10,tind)-Drift.gashound(16,tind)),'r.');
hold on;
plot(Drift.gashound(1,tind),(Drift.gashound(24,tind)-Drift.gashound(16,tind)),'b.');
hold off;
datetick('x');
xlabel('Time','FontWeight','Bold');
ylabel('PPM','FontWeight','Bold');
titl=sprintf('%s pC02',graphtitle);
legend('Water','Air');
title(titl,'FontWeight','Bold');
subplot(2,2,2);
plot(Drift.gashound(1,tind),Drift.gashound(4,tind),'r.');
hold on;
plot(Drift.gashound(1,tind),Drift.gashound(22,tind),'b.');
hold off;
datetick('x');
xlabel('Time','FontWeight','Bold');
ylabel('kPa','FontWeight','Bold');
titl=sprintf('%s Air Pressure',graphtitle);
legend('Pump on','Pump off(true)');
title(titl,'FontWeight','Bold');
subplot(2,2,3);
plot(Drift.gashound(1,tind),Drift.gashound(27,tind),'r.');
datetick('x');
xlabel('Time','FontWeight','Bold');
ylabel('PPM','FontWeight','Bold');
titl=sprintf('%s Delta pC02',graphtitle);
title(titl,'FontWeight','Bold');
subplot(2,2,4);
plot(Drift.gashound(1,tind),Drift.gashound(26,tind),'g-');
datetick('x');
xlabel('Time','FontWeight','Bold');
ylabel('Percent','FontWeight','Bold');
titl=sprintf('%s Percent Sea O2 Saturation from Atmosphere',graphtitle);
title(titl,'FontWeight','Bold');

set(inst_plot,'Position',[3 29 1022 672]);