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

inst_plot=figure;
set(inst_plot,'name','Spec 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.specprr(1,:)>=now-t);
XLim=[(now-t) now];


subplot(3,1,1)
plot(Drift.specprr(1,tind),Drift.specprr(2:7,tind));
YLim=[0 max(max(Drift.specprr(2:7,tind)))];
set(gca, 'XLim', XLim,'YLim', YLim)
datetick('x');
legend('Es412','Es443','Es490','Es510','Es555','Es656',-1);
title(sprintf('%s 0m-Es Sensor',graphtitle));
ylabel('uW/m2/nm');
subplot(3,1,2)
plot(Drift.specprr(1,tind),Drift.specprr(30:35,tind));
YLim=[0 max(max(Drift.specprr(30:35,tind)))];
set(gca, 'XLim', XLim,'YLim', YLim)
datetick('x');
legend('Ed412','Ed443','Ed490','Ed510','Ed555','Ed656',-1);
title(sprintf('%s 20m-Ed Sensor',graphtitle));
ylabel('uW/m2/nm');
subplot(3,1,3)
plot(Drift.specprr(1,tind),Drift.specprr(46:52,tind));
YLim=[0 max(max(Drift.specprr(46:52,tind)))];
set(gca, 'XLim', XLim,'YLim', YLim)
datetick('x');
legend('Lu412','Lu443','Lu490','Lu510','Lu555','Lu656','Lu683',-1);
title(sprintf('%s 20m-Lu Sensor',graphtitle));
ylabel('uW/m2/nm');
