use = find(qc == 0 & qc_Sc == 0 & AGC_c == 0 & u > 0.2 & PAR > 1000);
figure; hold on;
scatter(Ta(use),-NEE_c(use),5,[0.8 0.8 0.8]);
binplot_v2(Ta(use),-NEE_c(use),15,'k',6);
plot([10 40],[0 0],'k--');
axis([10 40 -10 25]);
xlabel('Ta (°C)');
ylabel('-NEE (\mumol m^-^2 s^-^1)');

% VPD bins
VPDbins = [0 2 3 4 8];
colorbin = colormap(jet(4));
for i = 1:length(VPDbins)-1
use = find(qc == 0 & qc_Sc == 0 & AGC_c == 0 & u > 0.2 ...
    & PAR > 1000 & VPD > VPDbins(i) & VPD < VPDbins(i+1));
binplot_v2(Ta(use),-NEE_c(use),4,colorbin(i,:),5);
end

legend('NEE','Median NEE',...
    'NEE = 0 line','D < 2 kPa','D = [2,3] kPa',...
    'D = [3,4] kPa', 'D > 4 kPa');

% Same figure, with GPP
use = find(qc == 0 & qc_Sc == 0 & AGC_c == 0 & u > 0.2 & PAR > 1000);
figure; hold on;
scatter(Ta(use),-GPP(use),5,[0.8 0.8 0.8]);
binplot_v2(Ta(use),-GPP(use),15,'k',6);
plot([10 40],[0 0],'k--');
axis([10 40 -10 25]);
xlabel('Ta (°C)');
ylabel('-GPP (\mumol m^-^2 s^-^1)');

% VPD bins
VPDbins = [0 2 3 4 8];
for i = 1:length(VPDbins)-1
use = find(qc == 0 & qc_Sc == 0 & AGC_c == 0 & u > 0.2 ...
    & PAR > 1000 & VPD > VPDbins(i) & VPD < VPDbins(i+1));
binplot_v2(Ta(use),-GPP(use),6,colorbin(i,:),5);
end

legend('GPP','Median GPP',...
    'GPP = 0 line','D < 2 kPa','D = [2,3] kPa',...
    'D = [3,4] kPa', 'D > 4 kPa');


% Same figure, with ER (SOLO)
use = find(qc == 0 & qc_Sc == 0 & AGC_c == 0 & u > 0.2 & PAR > 1000);
figure; hold on;
scatter(Ta(use),ER(use),5,[0.8 0.8 0.8]);
binplot_v2(Ta(use),ER(use),15,'k',6);
plot([10 40],[0 0],'k--');
axis([10 40 -10 25]);
xlabel('Ta (°C)');
ylabel('ER (\mumol m^-^2 s^-^1)');

% VPD bins
VPDbins = [0 2 3 4 8];
for i = 1:length(VPDbins)-1
use = find(qc == 0 & qc_Sc == 0 & AGC_c == 0 & u > 0.2 ...
    & PAR > 1000 & VPD > VPDbins(i) & VPD < VPDbins(i+1));
binplot_v2(Ta(use),ER(use),6,colorbin(i,:),5);
end

legend('ER','Median ER',...
    'ER = 0 line','D < 2 kPa','D = [2,3] kPa',...
    'D = [3,4] kPa', 'D > 4 kPa');

