0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function varargout = miplot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 % MIPLOT provides an intelligent plotting tool for LTPDA.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % DESCRIPTION: MIPLOT provides an intelligent plotting tool for LTPDA.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % CALL: h = plot (a,pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % INPUTS: pl - a parameter list
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % a - input analysis object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % OUTPUTS: h - handles to plot objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % Plot parameters:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % 'type' - one of the data class types
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 % 'tsdata' [default], 'fsdata', 'cdata', 'xydata', 'xyzdata'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % 'Arrangement' - select the plot layout:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 % 'single' - plots all AOs on individual figures
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % 'stacked' - plots all AOs on the same axes [default]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % 'subplots' - plots all AOs on subplots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 % Line parameters:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 % The following properties take cell array values. If the length of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % the cell array is shorter than the number of lines to plot, the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 % remaining lines will be plotted with the default options.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 % 'Colors' - a cell array of color definitions which will be
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 % looped over for each line.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % 'LineStyles' - a cell array of line styles.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % 'Legends' - specify a cell array of strings to be used for
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 % the plot legends. If a cell contains an empty
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 % string, the default legend string is built.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % If a single string 'off' is given instead of a
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 % cell array, then the legends are all switched
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % off.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 % 'XLabels' - Specify the labels to be used on the x-axis. The
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % units are added from the data object 'xunits'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 % property.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 % 'YLabels' - Specify the labels to be used on the y-axis. The
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 % units are added from the data object 'yunits'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 % property. If the object contains complex data,
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 % you should specify two y-labels for that object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 % 'XScales' - Specify the scales to be used on the x-axes.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 % 'YScales' - Specify the scales to the used on the y-axes. If
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 % an object contains complex data, you should
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 % specify two y-labels for that object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % 'LineWidths' - an array of line widths. If the length of the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 % array is shorter than the number of lines to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 % plot, the remaining lines will be plotted with
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 % the default line width.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 % VERSION: $Id: miplot.m,v 1.3 2008/02/07 19:51:53 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 % The following call returns a parameter list object that contains the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 % default parameter values:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 % >> pl = miplot(ao, 'Params')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 % HISTORY: 22-12-07 M Hewitson
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 % Creation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 % TODO:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 % 1) Add XRange, YRange, ZRange
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 % 2) Add/test math functions to all plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 %% Check if this is a call for parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 VERSION = '$Id: miplot.m,v 1.3 2008/02/07 19:51:53 hewitson Exp $';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 bs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 if nargin == 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 if isa(varargin{1}, 'ao') && ischar(varargin{2})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 in = char(varargin{2});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 if strcmp(in, 'Params')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 varargout{1} = getDefaultPL();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 elseif strcmp(in, 'Version')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 varargout{1} = VERSION;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 %% Collect input ao's, plist's and ao variable names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 in_names = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 for ii = 1:nargin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 in_names{end+1} = inputname(ii);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 [as, upl, invars] = collect_inputs(varargin, in_names);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 %% Go through AOs and collect them into similar types
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 tsAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 fsAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 xyAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 xyzAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 cAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 for j=1:numel(as)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 switch class(as(j).data)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 case 'tsdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 tsAOs = [tsAOs as(j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 case 'fsdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 fsAOs = [fsAOs as(j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 case 'xydata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 xyAOs = [xyAOs as(j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 case 'xyzdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 xyzAOs = [xyzAOs as(j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 case 'cdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 cAOs = [cAOs as(j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 warning('!!! Unknown data type %s', class(as(j).data));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 %% Now plot all the objects on separate figures
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 %----------- TSDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 dpl = getDefaultPlist('tsdata');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 pl = combine(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 % Call x-y plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 [hfig, hax, hli] = xy_plot(tsAOs, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 %----------- XYDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 dpl = getDefaultPlist('xydata');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 pl = combine(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 % Call x-y plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 [hfig, hax, hli] = xy_plot(xyAOs, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 %----------- XYZDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 dpl = getDefaultPlist('xyzdata');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 pl = combine(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 % Call x-y-z plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 [hfig, hax, hli] = xyz_plot(xyzAOs, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 %----------- CDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 dpl = getDefaultPlist('cdata');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 pl = combine(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 % Call x-y plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 [hfig, hax, hli] = y_plot(cAOs, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 %----------- FSDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 dpl = getDefaultPlist('fsdata');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 pl = combine(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 % Call fsdata plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 [hfig, hax, hli] = fs_plot(fsAOs, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % Plot fsdata objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 function varargout = fs_plot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 aos = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 % Extract parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 arrangement = find(pl, 'Arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 colors = find(pl, 'Colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 linestyles = find(pl, 'LineStyles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 linewidths = find(pl, 'LineWidths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 legends = find(pl, 'Legends');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 ylabels = find(pl, 'YLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 xlabels = find(pl, 'XLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 yscales = find(pl, 'YScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 xscales = find(pl, 'XScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 yranges = find(pl, 'YRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 xranges = find(pl, 'XRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 xmaths = find(pl, 'XMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 ymaths = find(pl, 'YMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 complexPlotType = find(pl, 'complexPlotType');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 % check whether we want legends or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 if iscell(legends)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 if strcmpi(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 legendsOn = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 legends = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 if ~iscell(linestyles), linestyles = {linestyles}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 if ~iscell(legends), legends = {legends}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 if ~iscell(ylabels), ylabels = {ylabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 if ~iscell(xlabels), xlabels = {xlabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 if ~iscell(xmaths), xmaths = {xmaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 if ~iscell(ymaths), ymaths = {ymaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 if ~iscell(xscales), xscales = {xscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 if ~iscell(yscales), yscales = {yscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 if ~iscell(xranges), xranges = {xranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 if ~iscell(yranges), yranges = {yranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 % collect figure handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 tsfig = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 tsax = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 tsli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 % Legend holder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 legendStr = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 if ~isempty(aos)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 % Now loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 Na = length(aos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 % - first to check if any are complex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 haveComplex = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 for j=1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 a = aos(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 y = a.data.y;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 ymath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 if j<=length(ymaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 if ~isempty(ymaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 eval(sprintf('y = %s;', ymaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 ymath = ymaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 xmath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 if j<=length(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 if ~isempty(xmaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 eval(sprintf('x = %s;', xmaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 xmath = xmaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 if ~isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 haveComplex = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 % Loop over the AOs now
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 for j=1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 % set real and imag subplot handles to empty
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 tsax_r = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 tsax_i = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 % Get this AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 a = aos(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 %------- Apply math functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 x = a.data.x;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 y = a.data.y;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 ymath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 if j<=length(ymaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 if ~isempty(ymaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 eval(sprintf('y = %s;', ymaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 ymath = ymaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 xmath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 if j<=length(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 if ~isempty(xmaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 eval(sprintf('x = %s;', xmaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 xmath = xmaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 % what figures do we need?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 switch arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 case 'single'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 tsfig = [tsfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 % check if this data set is real or complex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 if ~isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 % complex means we use two subplots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 tsax_r = subplot(2,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 tsax_i = subplot(2,1,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 tsax = [tsax tsax_r tsax_i];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 % real means we use a single subplot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 tsax_r = subplot(1, 1, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 tsax = [tsax tsax_r];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 case 'stacked'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 if j==1, tsfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 % if at least one of the input fsdata AOs is complex, we need to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 % allow for subplots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 if haveComplex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 tsax_r = subplot(2,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 tsax_i = subplot(2,1,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 tsax = [tsax_r tsax_i];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 tsax_r = subplot(1, 1, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 tsax = tsax_r;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 col = colors{mod(j-1,length(colors))+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 hold(tsax_r, 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 if ishandle(tsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 hold(tsax_i, 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 case 'subplots'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 if j == 1, tsfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 c = 1+(j-1)*2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 sx = Na;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 sy = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 % Now we have one or two subplots per input object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 if ~isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 tsax_r = subplot(sx, sy,c);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 tsax_i = subplot(sx, sy,c+1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 tsax = [tsax tsax_r tsax_i];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 tsax_r = subplot(sx, sy, c:c+1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 tsax = [tsax tsax_r];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 error('### Unknown plot arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 % plot real or complex data and setup default values for scale and
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 % labels as we go.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 if isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 tsli = [tsli plot(tsax_r, x, y)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 ylabelr = 'amplitude';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 ylabeli = 'imag';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 yscaleR = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 yscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 xscaleR = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 xscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 switch complexPlotType
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 case 'realimag'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 tsli = [tsli plot(tsax_r, x, real(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 tsli = [tsli plot(tsax_i, x, imag(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 ylabelr = 'real';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 ylabeli = 'imag';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 yscaleR = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 yscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 xscaleR = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 xscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 case 'absdeg'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 tsli = [tsli plot(tsax_r, x, abs(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 tsli = [tsli plot(tsax_i, x, phase(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 ylabelr = 'amplitude';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 ylabeli = 'Phase [deg]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 yscaleR = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 yscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 xscaleR = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 xscaleI = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 case 'absrad'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 tsli = [tsli plot(tsax_r, x, abs(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 tsli = [tsli plot(tsax_i, x, angle(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 ylabelr = 'amplitude';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 ylabeli = 'phase [rad]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 yscaleR = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 yscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 xscaleR = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 xscaleI = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 error('### Unknown plot type for complex data');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 %------- Axis properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 % Set ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 c = 1+(j-1)*2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 if c<=length(ylabels)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 if ~isempty(ylabels{c})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 ylstrR = ylabels{c};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 ylstrR = ylabelr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 ylstrR = ylabelr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 if c<length(ylabels)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 if ~isempty(ylabels{c+1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 ylstrI = ylabels{c+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 ylstrI = ylabeli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 ylstrI = ylabeli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 if ~isempty(ymath)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 ymath = strrep(ymath, 'y', sprintf('%s', a.data.yunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428 ylstrR = [ylstrR ' [' ymath ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 ylstrR = [ylstrR ' [' a.data.yunits ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 ylabel(tsax_r, ylstrR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 if ishandle(tsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 ylabel(tsax_i, ylstrI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 % Set xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 if j<=length(xlabels) && ~isempty(xlabels{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 xlstr = xlabels{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 xlstr = find(pl, 'XLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 if ~isempty(xmath)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 xmath = strrep(xmath, 'x', sprintf('%s', a.data.xunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445 xlstr = [xlstr ' [' xmath ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 xlstr = [xlstr ' [' a.data.xunits ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 xlabel(tsax_r, xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 if ishandle(tsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 xlabel(tsax_i, xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 % Set grid on or off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 grid(tsax_r, 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 if ishandle(tsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457 grid(tsax_i, 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460 % Set Y scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461 c = 1+(j-1)*2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 if c<=length(yscales)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463 if ~isempty(yscales{c})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 yscaleR = yscales{c};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 if c<length(yscales)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 if ~isempty(yscales{c+1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 yscaleI = yscales{c+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 set(tsax_r, 'YScale', yscaleR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473 if ishandle(tsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474 set(tsax_i, 'YScale', yscaleI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477 % Set X scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 c = 1+(j-1)*2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479 if c<=length(xscales)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 if ~isempty(xscales{c})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481 xscaleR = xscales{c};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484 if c<length(xscales)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485 if ~isempty(xscales{c+1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 xscaleI = xscales{c+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 set(tsax_r, 'XScale', xscaleR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490 if ishandle(tsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491 set(tsax_i, 'XScale', xscaleI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 % Set Y range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495 c = 1+(j-1)*2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496 if c<=length(yranges)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 if ~isempty(yranges{c})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498 set(tsax_r, 'YLim', yranges{c});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 if c<length(yranges)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 if ~isempty(yranges{c+1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503 if ishandle(tsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504 set(tsax_i, 'YLim', yranges{c+1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509 % Set X range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 c = 1+(j-1)*2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511 if c<=length(xranges)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512 if ~isempty(xranges{c})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 set(tsax_r, 'XLim', xranges{c});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516 if c<length(xranges)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517 if ~isempty(xranges{c+1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 if ishandle(tsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 set(tsax_i, 'XLim', xranges{c+1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524 %------- line properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
526 % Set line color
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
527 if isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
528 set(tsli(end), 'Color', col);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
529 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
530 set(tsli(end-1), 'Color', col);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
531 set(tsli(end), 'Color', col);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
532 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
533
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
534 % Set line style
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
535 if j<=length(linestyles) && ~isempty(linestyles{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
536 if isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
537 set(tsli(end), 'LineStyle', linestyles{j});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
538 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
539 set(tsli(end-1), 'LineStyle', linestyles{j});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
540 set(tsli(end), 'LineStyle', linestyles{j});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
541 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
542 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
543
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
544 % Set line widths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
545 if j<=length(linewidths) && ~isempty(linewidths(j))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
546 if isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
547 set(tsli(end), 'LineWidth', linewidths(j));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
548 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
549 set(tsli(end-1), 'LineWidth', linewidths(j));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
550 set(tsli(end), 'LineWidth', linewidths(j));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
551 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
552 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
553
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
554 % Set legend string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
555 lstr = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
556 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
557 if j<=length(legends) && ~isempty(legends{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
558 lstr = legends{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
559 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
560 lstr = ltpda_label(a.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
561 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
562 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
563 legendStr = [legendStr cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
564
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
565 % Set the legend now if we can
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
566 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
567 if strcmp(arrangement, 'single') || strcmp(arrangement, 'subplots')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
568 legend(tsax_r, legendStr{end});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
569 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
570 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
571
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
572 end % End loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
573
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
574 % Process legends for stacked plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
575 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
576 if strcmp(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
577 h = legend(tsax_r, legendStr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
578 set(h, 'FontSize', 10)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
579 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
580 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
581
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
582 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
583
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
584 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
585 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
586 varargout{1} = tsfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
587 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
588 if nargout > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
589 varargout{2} = tsax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
590 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
591 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
592 varargout{3} = tsli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
593 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
594 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
595 error('### Too many output arguments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
596 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
597
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
598 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
599 % Plot tsdata and xydata objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
600 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
601 function varargout = xy_plot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
602
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
603 aos = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
604 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
605
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
606 % Extract parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
607 arrangement = find(pl, 'Arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
608 colors = find(pl, 'Colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
609 linestyles = find(pl, 'LineStyles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
610 linewidths = find(pl, 'LineWidths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
611 legends = find(pl, 'Legends');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
612 ylabels = find(pl, 'YLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
613 xlabels = find(pl, 'XLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
614 xmaths = find(pl, 'XMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
615 ymaths = find(pl, 'YMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
616
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
617 % check whether we want legends or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
618 if iscell(legends)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
619 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
620 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
621 if strcmpi(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
622 legendsOn = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
623 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
624 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
625 legends = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
626 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
627 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
628
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
629 if ~iscell(linestyles), linestyles = {linestyles}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
630 if ~iscell(legends), legends = {legends}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
631 if ~iscell(ylabels), ylabels = {ylabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
632 if ~iscell(xlabels), xlabels = {xlabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
633 if ~iscell(xmaths), xmaths = {xmaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
634 if ~iscell(ymaths), ymaths = {ymaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
635
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
636
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
637 % collect figure handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
638 tsfig = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
639 tsax = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
640 tsli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
641
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
642 % Legend holder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
643 legendStr = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
644
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
645 if ~isempty(aos)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
646
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
647 % Now loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
648 Na = length(aos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
649 for j=1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
650
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
651 % Get this AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
652 a = aos(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
653
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
654 % what figures do we need?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
655 switch arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
656 case 'single'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
657
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
658 tsfig = [tsfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
659 tsax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
660 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
661
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
662 case 'stacked'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
663
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
664 if j==1, tsfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
665 tsax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
666 col = colors{mod(j-1,length(colors))+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
667 hold on;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
668
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
669 case 'subplots'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
670
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
671 if j == 1, tsfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
672 tsax = [tsax subplot(Na, 1, j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
673 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
674
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
675 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
676 error('### Unknown plot arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
677 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
678
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
679 %------- Apply math functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
680 x = a.data.x;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
681 y = a.data.y;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
682
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
683 ymath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
684 if j<=length(ymaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
685 if ~isempty(ymaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
686 eval(sprintf('y = %s;', ymaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
687 ymath = ymaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
688 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
689 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
690 xmath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
691 if j<=length(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
692 if ~isempty(xmaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
693 eval(sprintf('x = %s;', xmaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
694 xmath = xmaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
695 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
696 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
697
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
698 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
699
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
700 tsli = [tsli plot(tsax(end), x, y)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
701
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
702 %------- Axis properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
703
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
704 % Set ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
705 if j<=length(ylabels) && ~isempty(ylabels{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
706 ylstr = ylabels{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
707 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
708 ylstr = find(pl, 'YLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
709 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
710 if ~isempty(ymath)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
711 ymath = strrep(ymath, 'y', sprintf('%s', a.data.yunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
712 ylstr = [ylstr ' [' ymath ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
713 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
714 ylstr = [ylstr ' [' a.data.yunits ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
715 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
716 ylabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
717
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
718 % Set xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
719 if j<=length(xlabels) && ~isempty(xlabels{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
720 xlstr = xlabels{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
721 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
722 xlstr = find(pl, 'XLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
723 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
724 if ~isempty(xmath)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
725 xmath = strrep(xmath, 'x', sprintf('%s', a.data.xunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
726 xlstr = [xlstr ' [' xmath ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
727 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
728 xlstr = [xlstr ' [' a.data.xunits ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
729 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
730 xlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
731
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
732
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
733 % Set grid on or off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
734 grid(tsax(end), 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
735
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
736 %------- line properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
737
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
738 % Set line color
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
739 set(tsli(end), 'Color', col);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
740
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
741 % Set line style
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
742 if j<=length(linestyles) && ~isempty(linestyles{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
743 set(tsli(end), 'LineStyle', linestyles{j});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
744 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
745
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
746 % Set line widths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
747 if j<=length(linewidths) && ~isempty(linewidths(j))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
748 set(tsli(end), 'LineWidth', linewidths(j));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
749 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
750
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
751 % Set legend string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
752 lstr = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
753 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
754 if j<=length(legends) && ~isempty(legends{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
755 lstr = legends{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
756 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
757 lstr = ltpda_label(a.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
758 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
759 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
760 legendStr = [legendStr cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
761
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
762 % Set the legend now if we can
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
763 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
764 if strcmp(arrangement, 'single') || strcmp(arrangement, 'subplots')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
765 legend(legendStr{end});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
766 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
767 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
768 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
769
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
770 % Process legends for stacked plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
771 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
772 if strcmp(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
773 h = legend(legendStr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
774 set(h, 'FontSize', 10)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
775 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
776 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
777
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
778 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
779
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
780 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
781 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
782 varargout{1} = tsfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
783 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
784 if nargout > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
785 varargout{2} = tsax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
786 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
787 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
788 varargout{3} = tsli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
789 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
790 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
791 error('### Too many output arguments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
792 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
793
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
794
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
795 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
796 % Plot cdata objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
797 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
798 function varargout = y_plot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
799
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
800 aos = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
801 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
802
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
803 % Extract parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
804 arrangement = find(pl, 'Arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
805 colors = find(pl, 'Colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
806 linestyles = find(pl, 'LineStyles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
807 linewidths = find(pl, 'LineWidths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
808 legends = find(pl, 'Legends');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
809 ylabels = find(pl, 'YLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
810 xlabels = find(pl, 'XLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
811 xmaths = find(pl, 'XMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
812 ymaths = find(pl, 'YMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
813
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
814 % check whether we want legends or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
815 if iscell(legends)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
816 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
817 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
818 if strcmp(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
819 legendsOn = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
820 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
821 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
822 legends = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
823 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
824 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
825
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
826 if ~iscell(linestyles), linestyles = {linestyles}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
827 if ~iscell(legends), legends = {legends}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
828 if ~iscell(ylabels), ylabels = {ylabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
829 if ~iscell(xlabels), xlabels = {xlabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
830 if ~iscell(xmaths), xmaths = {xmaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
831 if ~iscell(ymaths), ymaths = {ymaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
832
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
833 % collect figure handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
834 tsfig = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
835 tsax = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
836 tsli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
837
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
838 % Legend holder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
839 legendStr = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
840
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
841 if ~isempty(aos)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
842
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
843 % Now loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
844 Na = length(aos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
845 for j=1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
846
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
847 % Get this AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
848 a = aos(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
849
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
850 % what figures do we need?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
851 switch arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
852 case 'single'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
853
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
854 tsfig = [tsfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
855 tsax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
856 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
857
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
858 case 'stacked'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
859
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
860 if j==1, tsfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
861 tsax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
862 col = colors{mod(j-1,length(colors))+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
863 hold on;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
864
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
865 case 'subplots'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
866
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
867 if j == 1, tsfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
868 tsax = [tsax subplot(Na, 1, j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
869 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
870
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
871 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
872 error('### Unknown plot arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
873 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
874
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
875 %------- Apply math functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
876 x = 1:length(a.data.y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
877 y = a.data.y;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
878
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
879 ymath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
880 if j<=length(ymaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
881 if ~isempty(ymaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
882 eval(sprintf('y = %s;', ymaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
883 ymath = ymaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
884 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
885 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
886 xmath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
887 if j<=length(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
888 if ~isempty(xmaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
889 eval(sprintf('x = %s;', xmaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
890 xmath = xmaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
891 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
892 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
893
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
894 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
895
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
896 idcs = plot(tsax(end), x, y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
897 tsli = [tsli idcs(1:end).'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
898
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
899 %------- Axis properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
900
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
901 % Set ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
902 if j<=length(ylabels) && ~isempty(ylabels{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
903 ylstr = ylabels{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
904 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
905 ylstr = find(pl, 'YLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
906 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
907 if ~isempty(ymath)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
908 ymath = strrep(ymath, 'y', sprintf('%s', a.data.yunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
909 ylstr = [ylstr ' [' ymath ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
910 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
911 ylstr = [ylstr ' [' a.data.yunits ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
912 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
913 ylabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
914
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
915 % Set xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
916 if j<=length(xlabels) && ~isempty(xlabels{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
917 xlstr = xlabels{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
918 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
919 xlstr = find(pl, 'XLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
920 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
921 if ~isempty(xmath)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
922 xmath = strrep(xmath, 'x', sprintf('%s', a.data.xunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
923 xlstr = [xlstr ' [' xmath ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
924 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
925 xlstr = [xlstr ' [' a.data.xunits ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
926 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
927 xlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
928
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
929
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
930 % Set grid on or off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
931 grid(tsax(end), 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
932
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
933 %------- line properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
934
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
935 % Set line color
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
936 set(tsli(end), 'Color', col);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
937
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
938 % Set line style
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
939 if j<=length(linestyles) && ~isempty(linestyles{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
940 set(tsli(end), 'LineStyle', linestyles{j});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
941 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
942
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
943 % Set line widths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
944 if j<=length(linewidths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
945 set(tsli(end), 'LineWidth', linewidths(j));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
946 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
947
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
948 % Set legend string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
949 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
950 if j<=length(legends) && ~isempty(legends{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
951 legendStr = [legendStr legends(j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
952 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
953 lstr = ltpda_label(a.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
954 legendStr = [legendStr cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
955 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
956 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
957
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
958 % Set the legend now if we can
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
959 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
960 if strcmp(arrangement, 'single') || strcmp(arrangement, 'subplots')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
961 legend(legendStr{end});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
962 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
963 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
964 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
965
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
966 % Process legends for stacked plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
967 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
968 if strcmp(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
969 h = legend(legendStr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
970 set(h, 'FontSize', 10)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
971 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
972 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
973
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
974 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
975
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
976 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
977 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
978 varargout{1} = tsfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
979 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
980 if nargout > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
981 varargout{2} = tsax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
982 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
983 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
984 varargout{3} = tsli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
985 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
986 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
987 error('### Too many output arguments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
988 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
989
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
990 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
991 % Plot xyzdata objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
992 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
993 function varargout = xyz_plot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
994
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
995 aos = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
996 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
997
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
998 % Extract parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
999 arrangement = find(pl, 'Arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1000 colors = find(pl, 'Colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1001 linestyles = find(pl, 'LineStyles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1002 linewidths = find(pl, 'LineWidths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1003 legends = find(pl, 'Legends');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1004 zlabels = find(pl, 'ZLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1005 ylabels = find(pl, 'YLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1006 xlabels = find(pl, 'XLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1007 xmaths = find(pl, 'XMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1008 ymaths = find(pl, 'YMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1009 zmaths = find(pl, 'ZMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1010
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1011 % check whether we want legends or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1012 if iscell(legends)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1013 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1014 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1015 if strcmp(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1016 legendsOn = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1017 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1018 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1019 legends = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1020 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1021 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1022
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1023 % collect figure handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1024 tsfig = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1025 tsax = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1026 tsli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1027
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1028 % Legend holder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1029 legendStr = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1030
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1031 if ~isempty(aos)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1032
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1033 % Now loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1034 Na = length(aos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1035 for j=1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1036
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1037 % Get this AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1038 a = aos(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1039
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1040 % what figures do we need?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1041 switch arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1042 case 'single'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1043
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1044 tsfig = [tsfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1045 tsax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1046
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1047 case 'subplots'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1048
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1049 if j == 1, tsfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1050 tsax = [tsax subplot(Na, 1, j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1051
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1052 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1053 error('### Unknown plot arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1054 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1055
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1056 %------- Apply math functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1057 x = a.data.x;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1058 y = a.data.y;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1059 z = a.data.z;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1060
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1061
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1062 ymath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1063 if j<=length(ymaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1064 if ~isempty(ymaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1065 eval(sprintf('y = %s;', ymaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1066 ymath = ymaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1067 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1068 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1069 xmath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1070 if j<=length(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1071 if ~isempty(xmaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1072 eval(sprintf('x = %s;', xmaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1073 xmath = xmaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1074 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1075 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1076 zmath = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1077 if j<=length(zmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1078 if ~isempty(zmaths{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1079 eval(sprintf('z = %s;', zmaths{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1080 zmath = zmaths{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1081 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1082 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1083
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1084 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1085
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1086 idcs = pcolor(x,y,z);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1087 tsli = [tsli idcs(1:end).'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1088
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1089 % plot properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1090 set(idcs, 'EdgeColor', 'none');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1091
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1092 %------- Axis properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1093
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1094 % Reverse y-direction for spectrograms
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1095 set(tsax(end), 'YDir', 'reverse');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1096
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1097 % Set ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1098 if j<=length(ylabels) && ~isempty(ylabels{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1099 ylstr = ylabels{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1100 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1101 ylstr = find(pl, 'YLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1102 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1103 if ~isempty(ymath)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1104 ymath = strrep(ymath, 'y', sprintf('%s', a.data.yunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1105 ylstr = [ylstr ' [' ymath ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1106 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1107 ylstr = [ylstr ' [' a.data.yunits ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1108 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1109 ylabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1110
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1111 % Set xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1112 if j<=length(xlabels) && ~isempty(xlabels{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1113 xlstr = xlabels{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1114 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1115 xlstr = find(pl, 'XLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1116 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1117 if ~isempty(xmath)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1118 xmath = strrep(xmath, 'x', sprintf('%s', a.data.xunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1119 xlstr = [xlstr ' [' xmath ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1120 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1121 xlstr = [xlstr ' [' a.data.xunits ']' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1122 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1123 xlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1124
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1125 % Set grid on or off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1126 grid(tsax(end), 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1127
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1128 % Set title string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1129 if ~strcmpi(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1130 if j<=length(legends) && ~isempty(legends{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1131 legendStr = [legendStr legends(j)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1132 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1133 lstr = ltpda_label(a.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1134 legendStr = [legendStr cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1135 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1136 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1137
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1138 % Set the legend now if we can
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1139 tstr = legendStr{end};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1140 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1141 title(tstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1142 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1143
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1144 % Set colorbars
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1145 hc = colorbar('peer', tsax(end));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1146 if j<=length(zlabels)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1147 if ~isempty(zlabels{j})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1148 zlstr = zlabels{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1149 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1150 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1151 zlstr = find(pl, 'Zlabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1152 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1153 if ~isempty(zmath), zlstr = [zlstr sprintf('\n%s', zmath)]; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1154 ylh = get(hc, 'YLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1155 set(ylh, 'String', zlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1156 set(ylh, 'Fontsize', get(tsax(end), 'Fontsize'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1157 set(ylh, 'FontName', get(tsax(end), 'FontName'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1158 set(ylh, 'FontAngle', get(tsax(end), 'FontAngle'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1159 set(ylh, 'FontWeight', get(tsax(end), 'FontWeight'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1160 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1161 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1162
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1163 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1164 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1165 varargout{1} = tsfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1166 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1167 if nargout > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1168 varargout{2} = tsax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1169 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1170 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1171 varargout{3} = tsli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1172 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1173 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1174 error('### Too many output arguments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1175 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1176
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1177
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1178 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1179 % Default Parameter Lists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1180 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1181 function out = getDefaultPlist(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1182
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1183 % list of available parameter sets
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1184 sets = {'tsdata', 'fsdata', 'cdata', 'xydata'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1185
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1186 % Get the LTPDA color set for lines
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1187 colors = getappdata(0,'ltpda_default_plot_colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1188
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1189 if nargin == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1190 out = sets;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1191 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1192 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1193
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1194 set = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1195
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1196 out = plist('Colors', colors, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1197 'Arrangement', 'stacked');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1198
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1199 switch set
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1200 case 'fsdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1201 out = append(out, 'type', 'fsdata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1202 'complexPlotType', 'absdeg', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1203 'XLabel', 'Frequency');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1204 case 'tsdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1205 out = append(out, 'type', 'tsdata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1206 'Xlabel', 'Time', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1207 'Ylabel', 'Amplitude');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1208 case 'xydata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1209 out = append(out, 'type', 'xydata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1210 'Xlabel', 'X-data', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1211 'Ylabel', 'Y-data', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1212 'YMaths', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1213 'XMaths', '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1214 case 'xyzdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1215 out = plist('Colors', colors, 'Arrangement', 'single', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1216 'type', 'xydata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1217 'Xlabel', 'Time', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1218 'Ylabel', 'Frequency',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1219 'Zlabel', 'Amplitude', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1220 'YMaths', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1221 'ZMaths', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1222 'XMaths', '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1223 case 'cdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1224 out = append(out, 'type', 'tsdata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1225 'Xlabel', 'Index', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1226 'Ylabel', 'Value');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1227 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1228 out = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1229 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1230
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1231
|