Newer
Older
function plot_Tsg( hTsgGUI, hAxes, PlotNum, Para, Linestyle, MyColor )
%
% Function to plot TSG parameters
% The program can plot parameter of style SSPS or SSPS_ADJUSTED
% in that last case we need to extract the name of the parameter
%
% Input
% -----
% hTsgGUI ........ Handle to the user interface
% hAxes ........ Handle to the graphic axes
% PlotNum ........ Plot Number (used for the TAG)
% Para ........... Parametre whose difference with TSG data is plot
% Linestyle ...... 1 - plot the line with markers
% 0 - only plot a continous line
% MyColor ........ [] - Draw Para taking into account color QC code
% 'k''b'... - Draw Para using Color code
% Retrieve named application data
% -------------------------------
tsg = getappdata( hTsgGUI, 'tsg_data');
if ~isempty( tsg.(Para) )
axes( hAxes(PlotNum) );
set( hAxes(PlotNum), 'Box', 'on' );
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
hold on
if Linestyle
Style = 'none';
Mark = '.';
else
Style = '-';
Mark = 'none';
end
% Extract the name of the parameter
% ---------------------------------
pos = regexp( Para, '_', 'ONCE');
if isempty( pos )
parameter = Para;
else
parameter = Para(1:pos-1);
end
if isempty(MyColor)
% get list of keys from hashtable tsg.qc.hash, defined inside
% tsg_initialisation.m
% -----------------------------------------------------------
qc_list = get(tsg.qc.hash);
% Plot Sample/TSG differences on axe 2
% 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.([Para '_QC']) == code );
if ~isempty( ind )
line( tsg.DAYD(ind), tsg.(Para)(ind), ...
'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para '_' key],...
'LineStyle', Style, ...
'Marker', Mark, 'MarkerSize', 5, 'Color', color);
end
end
end
else
line(tsg.DAYD, tsg.(Para),...
'Tag', ['TAG_PLOT' num2str(PlotNum) '_LINE_' Para], ...
'LineStyle', Style,'Marker', Mark, 'MarkerSize', 5, 'Color', MyColor);
end
hold off;
% Write some 'Y' label
% ------------------
set(get(hAxes(PlotNum), 'Ylabel'), 'Interpreter', 'none', 'String', Para);