Skip to content
Snippets Groups Projects
plot_SalTempVel.m 3.22 KiB
Newer Older
function plot_SalTempVel( hTsgGUI, hPlotAxes )
% Function to plot the Salinity, Temperature TSG data as well as the
% ship velocity
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
% hPlotAxes .......... Handels to the 3 graphic axes
%
% Output
% ------
% $Id$

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

% Plot the Salinity with the right color code
% -------------------------------------------
axes( hPlotAxes(1));
% plot all data in white to draw first axes before hold on if ind of
% tsg.SSPS_QC == NO_CONTROL is empty
% ----------------------------------
plot(hPlotAxes(1), tsg.DAYD, tsg.SSPS, '.w');
%set(hAxes(1), 'nextplot', 'add');
% get list of keys from hashtable tsg.qc.hash, defined inside
% tsg_initialisation.m
% -----------------------------------------------------------
qc_list = get(tsg.qc.hash);

% iterate (loop) on each key store inside hastable
% ------------------------------------------------
for i=1:numel(qc_list)
  
  % get key and some values in hashtable
  % ------------------------------------
  key   = qc_list{i};
  state = get(tsg.qc.hash, key, 'state');
  code  = get(tsg.qc.hash, key, 'code');
  color = get(tsg.qc.hash, key, 'color');
  
  % plot only for valid context menu (set to 'on')
  % ----------------------------------------------
  if strcmp( state, 'on')
    
    % plot tsg salinity sample with right code/color
    % ----------------------------------------------
    ind = find(tsg.SSPS_QC == code );
    plot(hPlotAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), strcat('.', color));
% Plot filtered salinity for test
% -------------------------------
plot(hPlotAxes(1), tsg.DAYD, tsg.ssps.smooth.val, 'k');
hold off;      

% refresh QC statistic panel
% --------------------------
display_QC( hTsgGUI, hPlotAxes );
% Plot Temperature with no qc color code
% --------------------------------------
axes( hPlotAxes(2));
set( hPlotAxes(2), 'box', 'on');
line(tsg.DAYD, tsg.SSJT, ...
     'Tag', 'TAG_AXES2_LINE_SSPS', 'Linestyle', '.', 'Color','b');
% Plot Ship Velocity with no qc color code
% -----------------------------------------
plot(hPlotAxes(3), tsg.DAYD, tsg.SPDC, '.k');

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

% Write some 'Y' label
% ------------------
set(get(hPlotAxes(1), 'Ylabel'), 'String', 'Salinity');
set(get(hPlotAxes(2), 'Ylabel'), 'String', 'Temperature (\circC)');
set(get(hPlotAxes(3), 'Ylabel'), 'String', 'Ship Velocity (knots)');

% Make the axes visible
% ---------------------
set(hPlotAxes(1), 'Visible', 'on' );
set(hPlotAxes(2), 'Visible', 'on' );
set(hPlotAxes(3), 'Visible', 'on' );

% The 3 axes will behave identically when zoomed and panned
% ---------------------------------------------------------
linkaxes([hPlotAxes(1),hPlotAxes(2),hPlotAxes(3)], 'x');