iupper = 1:20;
fig1 = figure('Visible','on');
tl = tiledlayout(3,1,"TileSpacing","tight");
nexttile
plot(dailyAnoms.date,meano2anom,'.')
ylabel('meanO2Anom')
hold on
yyaxis right
ylabel('DIC')
plot(dailyAnoms.date,DIC,'.')
xticklabels([])
title('mean of upper 5 m')

nexttile
pcolor(dailyAnoms.date,s.depth(iupper,idiel(1)),s.o2anom(iupper,idiel))
xticklabels([])
shading interp
cb1 = colorbar;
ylabel(cb1,'O_2 anom')
ylabel('depth')
if numel(dailyAverages.date(1):.25:dailyAverages.date(end)+1) < 15
    xticks(dailyAverages.date(1):.25:dailyAverages.date(end)+1)
else
    xticks(dailyAverages.date(1):.5:dailyAverages.date(end)+1)
end

nexttile
pcolor(dailyAnoms.date,s.depth(iupper,idiel(1)),s.dic_canb(iupper,idiel))
shading interp
cb2 = colorbar;
ylabel(cb2,'DIC')

xtickformat('HH:mm')
xtickangle(45)
xlabel(tl,'Local time (hours:minutes)')
ylabel('depth')
%%
pngfilename = ['Mission_',num2str(gdata.MissionID(mission)),'_Profiles_',num2str(gdata.StartProf(mission)),'_',num2str(gdata.EndProf(mission)),'_Diel_With_Depth.png'];
% exportgraphics(fig1,pngfilename, "Resolution",600);
frame = getframe(fig1);
imwrite(frame.cdata, pngfilename, 'png');
