function plot_TsgAdjusted( hTsgGUI, hPlotAxes )

% Function to plot :
% 1 - tsg.SSPS raw data on axes 2
% 2 - tsg.SSPS_ADJUSTED on axe 3
%
% Input
% -----
% hTsgGUI ........ Handel to the user interface
% hPlotAxes ...... Handels to the graphic axes
%
% TO DO :
% plot_TsgAdjusted : plot the computed error

FILLVALUE = 99.99;

% Retrieve named application data
% -------------------------------
tsg = getappdata( hTsgGUI, 'tsg_data');

% Only plot valid values
% ----------------------
ind = find(tsg.SSPS_ADJUSTED < FILLVALUE-1);

% Plot tsg.SSPS (raw data) on axes 3
% ----------------------------------
axes(hPlotAxes(3))
plot(tsg.DAYD, tsg.SSPS, 'k' );

hold on;
%set(hAxes(1), 'nextplot', 'add');

% Plot tsg.SSPS_ADJUSTED (corrected data) on axes 3
% -------------------------------------------------
if ~isempty( ind )
  plot(tsg.DAYD(ind), tsg.SSPS_ADJUSTED(ind), 'b' );
end
hold off

% Plot the difference tsg.SSPS_ADJUSTED-tsg.SSPS on axe 2
% -------------------------------------------------------
axes(hPlotAxes(2));
hold on;
%set(hAxes(1), 'nextplot', 'add');

if ~isempty( ind )
  plot(tsg.DAYD(ind), tsg.SSPS_ADJUSTED(ind)-tsg.SSPS(ind), 'b' );
end
hold off

% Formatted x-TIME axes
% ---------------------
set(hPlotAxes(3), 'Xlim', [tsg.DAYD(1)-1 tsg.DAYD(end)+1]);
set(hPlotAxes(3),'XTickMode','auto')
datetick(hPlotAxes(3),'x','keeplimits')
