0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % IPLOT provides an intelligent plotting tool for LTPDA.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: IPLOT provides an intelligent plotting tool for LTPDA.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % CALL: hfig = iplot (a,pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % [hfig, hax] = iplot (a,pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % [hfig, hax, hli] = iplot (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: hfig - handles to figures
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % hax - handles to axes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % hli - handles to lines
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % AO Plot Info
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 % ------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % If an input AO has a filled plotinfo plist, then the options contained in
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 % therein will overide any other options. The recognised keys are:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % 'linestyle', 'linewidth', 'color', 'marker', 'legend_on'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 % The possible values are all those accepted by plot.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % Notes on Parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 % -------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 % Many of the properties take cell-array values. If the length of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 % the cell array is shorter than the number of lines to plot, the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % remaining lines will be plotted with the default options. If the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % cell array is of length 2 and the first cell contains the string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % 'all', then the second cell is used to set the propery of all
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % lines.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % Error parameters: If you give more than one input AO then you must
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 % specify the following parameter values in a cell-array,
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % one cell for each input AO. Leave the cell empty to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % plot no errors. Each error can be a value or a vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 % the same length as the data vector. If you give and
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % upper limit but not lower limit, then the errors are
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 % assumed to be symmetric (and vice versa)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 % EXAMPLES:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 % 1) Plot two time-series AOs with different colors, line styles, and widths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 % pl = plist('Linecolors', {'g', 'k'}, 'LineStyles', {'None', '--'}, 'LineWidths', {1, 4});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 % iplot(tsao1, tsao2, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 % 2) Plot two time-series AOs in subplots. Also override the second legend
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 % text and the first line style.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % pl = plist('Arrangement', 'subplots', 'LineStyles', {'--'}, 'Legends', {'', 'My Sine Wave'});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 % iplot(tsao1, tsao2, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % 3) Plot two frequency-series AOs on subplots with the same Y-scales and
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 % Y-ranges
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 % pl1 = plist('Yscales', {'All', 'lin'});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 % pl2 = plist('arrangement', 'subplots', 'YRanges', {'All', [1e-6 100]});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 % iplot(fsd1, fsd2, pl1, pl2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'iplot')">Parameters Description</a>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 % VERSION: $Id: iplot.m,v 1.139 2011/06/01 13:08:47 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 % DEPRECATED xmaths and ymaths in release 2.4
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 % 3) Plot two time-series AOs taking the square of the y-values of the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 % first AO and the log of the x-values of the second AO.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 % pl = plist('Arrangement', 'subplots', 'YMaths', 'y.^2', 'XMaths', {'', 'log(x)'});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 % iplot(tsao1, tsao2, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 % Math operations: You can specify rudimentary math operations to be
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 % performed on the X and Y data prior to plotting. The
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 % 'all' keyword is also supported by these parameters.
|
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
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 % TODO:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 % 1) Add XRange, YRange, ZRange to xyzdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 function varargout = iplot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 import utils.const.*
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 %% Check if this is a call for parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 if utils.helper.isinfocall(varargin{:})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 varargout{1} = getInfo(varargin{3});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 % Collect input variable names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 in_names = cell(size(varargin));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 for ii = 1:nargin,in_names{ii} = inputname(ii);end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 % Collect all AOs and plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 [upl, pl_invars] = utils.helper.collect_objects(varargin(:), 'plist', in_names);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 if numel(upl)>1, upl = combine(upl); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 %% Go through AOs and collect them into similar types
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 tsAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 fsAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 xyAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 xyzAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 cAOs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 consistent = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 for jj = 1:numel(as)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 % Check if AOs are consistent (all containing data of the same class):
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 if ~strcmpi(class(as(jj).data) , class(as(1).data) ), consistent = 0; end;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 switch class(as(jj).data)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 case 'tsdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 if isempty(as(jj).y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 warning('AO %s has no data and will not be plotted', as(jj).name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 tsAOs = [tsAOs as(jj)]; %#ok<*AGROW>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 case 'fsdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 if isempty(as(jj).y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 warning('AO %s has no data and will not be plotted', as(jj).name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 fsAOs = [fsAOs as(jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 case 'xydata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 if isempty(as(jj).y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 warning('AO %s has no data and will not be plotted', as(jj).name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 xyAOs = [xyAOs as(jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 case 'xyzdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 if isempty(as(jj).y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 warning('AO %s has no data and will not be plotted', as(jj).name); %#ok<*WNTAG>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 xyzAOs = [xyzAOs as(jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 case 'cdata'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 if isempty(as(jj).y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 warning('AO %s has no data and will not be plotted', as(jj).name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 cAOs = [cAOs as(jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 warning('!!! Unknown data type %s', class(as(jj).data));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 %% Now plot all the objects on separate figures
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 % (unless they're consistent and a figure handle was passed)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 if consistent && ~isempty(upl), fig2plot = find(upl,'Figure'); else fig2plot = []; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 hfig = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 hax = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 hli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 %----------- TSDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 if ~isempty(tsAOs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 dpl = getDefaultPlist('Time-series plot');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 pl = parse(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 % Call x-y plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 [hf, ha, hl] = xy_plot(tsAOs, pl, fig2plot);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 hfig = [hfig hf];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 hax = [hax ha];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 hli = [hli hl];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 %----------- XYDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 if ~isempty(xyAOs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 dpl = getDefaultPlist('X-Y data plot');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 pl = parse(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 % Call x-y plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 [hf, ha, hl] = xy_plot(xyAOs, pl, fig2plot);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 hfig = [hfig hf];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 hax = [hax ha];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 hli = [hli hl];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 %----------- XYZDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 if ~isempty(xyzAOs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 dpl = getDefaultPlist('3D plot');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 pl = parse(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 % Call x-y-z plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 [hf, ha, hl] = xyz_plot(xyzAOs, pl, fig2plot);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 hfig = [hfig hf];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 hax = [hax ha];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 hli = [hli hl];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 %----------- CDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 if ~isempty(cAOs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 dpl = getDefaultPlist('Y data plot');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 pl = parse(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 % Call x-y plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 [hf, ha, hl] = y_plot(cAOs, pl, fig2plot);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 hfig = [hfig hf];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 hax = [hax ha];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 hli = [hli hl];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 %----------- FSDATA
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 if ~isempty(fsAOs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 % get default plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 dpl = getDefaultPlist('Frequency-series plot');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 % combine the plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 pl = parse(upl, dpl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 % Call fsdata plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 [hf, ha, hl] = fs_plot(fsAOs, pl, fig2plot);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 hfig = [hfig hf];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 hax = [hax ha];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 hli = [hli hl];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 %% Deal with outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 if nargout == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 varargout{1} = hfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 if nargout == 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 varargout{1} = hfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 varargout{2} = hax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 varargout{1} = hfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 varargout{2} = hax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 varargout{3} = hli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 error('### Incorrect number of outputs');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 % Plot fsdata objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 function varargout = fs_plot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 aos = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 fig2plot = varargin{3};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 UseLatex = find(pl, 'LatexLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 if ischar(UseLatex)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 UseLatex = eval(UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 % Extract parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 arrangement = find(pl, 'Arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 colors = find(pl, 'Colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 linecolors = find(pl, 'LineColors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 linestyles = find(pl, 'LineStyles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 markers = find(pl, 'Markers');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 linewidths = find(pl, 'LineWidths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 legends = find(pl, 'Legends');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 legendsFont = find(pl, 'LegendFontSize');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 ylabels = find(pl, 'YLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 xlabels = find(pl, 'XLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 yscales = find(pl, 'YScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 xscales = find(pl, 'XScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 yranges = find(pl, 'YRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 xranges = find(pl, 'XRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 xmaths = find(pl, 'XMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 ymaths = find(pl, 'YMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 type = find(pl, 'Function');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 legendLoc = find(pl, 'LegendLocation');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 complexPlotType = find(pl, 'complexPlotType');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 autoErrors = find(pl, 'AUTOERRORS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 % Convert the colour if it is a character to a cell-string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 if ischar(colors)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 colors = cellstr(colors);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 % get errors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 XerrL = find(pl, 'XerrL');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 XerrU = find(pl, 'XerrU');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 YerrL = find(pl, 'YerrL');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 YerrU = find(pl, 'YerrU');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 if ~iscell(XerrU), XerrU = {XerrU}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 if ~iscell(XerrL), XerrL = {XerrL}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 if ~iscell(YerrU), YerrU = {YerrU}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 if ~iscell(YerrL), YerrL = {YerrL}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 if (numel(XerrL) > 1 && numel(XerrL) ~= numel(aos)) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 (numel(YerrL) > 1 && numel(YerrL) ~= numel(aos)) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 (numel(XerrU) > 1 && numel(XerrU) ~= numel(aos)) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 (numel(YerrU) > 1 && numel(YerrU) ~= numel(aos))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 error('### Please specify 1 set of errors for all AOs, or a set of errors for each AO.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 % check whether we want legends or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 if iscell(legends)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 if strcmpi(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 legendsOn = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 legends = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 if ~isempty(ymaths) || ~isempty(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 warning('The use of the ''ymaths'' and ''xmaths'' parameters is deprecated. Please perform any calculations before calling iplot.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 if ~iscell(linewidths), linewidths = {linewidths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 if ~iscell(linestyles), linestyles = {linestyles}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 if ~iscell(linecolors), linecolors = {linecolors}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 if ~iscell(markers), markers = {markers}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 if ~iscell(legends), legends = {legends}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 if ~iscell(ylabels), ylabels = {ylabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 if ~iscell(xlabels), xlabels = {xlabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 if ~iscell(xmaths), xmaths = {xmaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 if ~iscell(ymaths), ymaths = {ymaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 if ~iscell(xscales), xscales = {xscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 if ~iscell(yscales), yscales = {yscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 if ~iscell(xranges), xranges = {xranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 if ~iscell(yranges), yranges = {yranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 % collect figure handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 fsfig = []; fsax = []; fsli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 % Legend holder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 legendStrR = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 legendStrI = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 % Helper variables
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 ymin = Inf;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 ymax = -Inf;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 xmin = Inf;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 xmax = -Inf;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 complexFig = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 complexAxes = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 if ~isempty(aos)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 % Now loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 Na = length(aos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 % First to check if any are complex y data including any Y maths at the same
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 % time.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 haveComplex = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 % Get data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 y = aos(jj).data.getY;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 % Do any math operations
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 ymath = parseOptions(jj, ymaths, 'y');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 eval(sprintf('y = %s;', ymath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 % Is this a complex plot?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 if ~isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 haveComplex = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 % Do we want to use a unit placeholder on the yaxis?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 yunits = aos(1).data.yunits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 yunitPlaceholder = '[Mixed]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 useYunitPlaceholder = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 if strcmpi(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 if yunits ~= aos(jj).data.yunits
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 useYunitPlaceholder = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 break;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 ylabeli = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 % Do we want to use a unit placeholder on the xaxis?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 xunits = aos(1).data.xunits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 xunitPlaceholder = '[Mixed]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 useXunitPlaceholder = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 if strcmpi(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 if xunits ~= aos(jj).data.xunits
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 useXunitPlaceholder = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 break;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 % No plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 if useYunitPlaceholder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 yunits = yunitPlaceholder;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 yunits = aos(jj).data.yunits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 if useXunitPlaceholder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 xunits = xunitPlaceholder;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 xunits = aos(jj).data.xunits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 % set real and imag subplot handles to empty
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 fsax_r = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 fsax_i = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 % Get data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 x = aos(jj).data.getX; y = aos(jj).data.getY;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 % Do any math operations
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 ymath = parseOptions(jj, ymaths, 'y'); eval(sprintf('y = %s;', ymath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 xmath = parseOptions(jj, xmaths, 'x'); eval(sprintf('x = %s;', xmath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 % what figures do we need?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 switch arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 case 'single'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 fsfig = [fsfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 % check if this data set is real or complex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 if ~isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 % complex means we use two subplots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428 fsax_r = subplot(2,1,1); fsax_i = subplot(2,1,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 fsax = [fsax fsax_r fsax_i];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 complexFig = [complexFig get(fsax_r, 'Parent')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 complexAxes = [complexAxes fsax_r fsax_i];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 % real means we use a single subplot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 fsax_r = subplot(1, 1, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435 fsax = [fsax fsax_r];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 % Make sure we reset the helper variables in this case
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 ymin = Inf; ymax = -Inf; xmin = Inf; xmax = -Inf;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 case 'stacked'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 if ~isempty(fig2plot), fsfig = fig2plot;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 elseif jj == 1, fsfig = figure;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 % if at least one of the input fsdata AOs is complex, we need to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 % allow for subplots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445 if haveComplex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 fsax_r = subplot(2,1,1,'Parent',fsfig); fsax_i = subplot(2,1,2,'Parent',fsfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 fsax = [fsax_r fsax_i];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 if jj == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 complexFig = [complexFig fsfig];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 complexAxes = [complexAxes fsax_r fsax_i];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453 fsax_r = subplot(1, 1, 1,'Parent',fsfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 fsax = fsax_r;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 col = colors{mod(jj-1,length(colors))+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457 hold(fsax_r, 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458 if ishandle(fsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459 hold(fsax_i, 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461 case 'subplots'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 if ~isempty(fig2plot), fsfig = fig2plot;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463 elseif jj == 1, fsfig = figure;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 c = 1+(jj-1)*2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466 sx = Na;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 sy = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 % Now we have one or two subplots per input object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 if ~isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470 fsax_r = subplot(sx, sy,c); fsax_i = subplot(sx, sy,c+1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 fsax = [fsax fsax_r fsax_i];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473 fsax_r = subplot(sx, sy, c:c+1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474 fsax = [fsax fsax_r];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477 % Make sure we reset the helper variables in this case
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 ymin = Inf; ymax = -Inf; xmin = Inf; xmax = -Inf;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 error('### Unknown plot arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 % Process errors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484 [fcn, xu, xl, yu, yl] = process_errors(jj, size(y), type, XerrU, XerrL, YerrU, YerrL, aos(jj), autoErrors);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 % plot real or complex data and setup default values for scale and
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 % labels as we go.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490 if isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491 % if the data are real, then we don't expect negative error bars
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492 idx = find(yl>abs(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493 yl(idx) = 0.999*abs(y(idx));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496 li = errorbar(fsax_r, x, y, yl, yu);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 le = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 li = feval(type, fsax_r, x, y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 lhs = errorbarxy(fsax_r, x, y, xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503 li = lhs(1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504 le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506 fsli = [fsli li];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507 ylabelr = ''; ylabeli = 'imag';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508 yscaleR = 'log'; yscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509 xscaleR = 'log'; xscaleI = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511 switch complexPlotType
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512 case 'realimag'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 ry = real(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516 ferr = yl./abs(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517 yl = ry.*ferr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 yu = ry.*ferr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 li = errorbar(fsax_r, x, ry, yl, yu);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520 le = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522 li = feval(type, fsax_r, x, real(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525 lhs = errorbarxy(fsax_r, x, real(y), xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
526 li = lhs(1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
527 le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
528 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
529 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
530 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
531 iy = imag(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
532 ferr = yl./abs(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
533 yl = iy.*ferr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
534 yu = iy.*ferr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
535 li = [li errorbar(fsax_i, x, iy, yl, yu)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
536 le = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
537 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
538 li = [li feval(type, fsax_i, x, imag(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
539 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
540 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
541 lhs = errorbarxy(fsax_i, x, imag(y), xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
542 li = [li lhs(1)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
543 le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
544 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
545 fsli = [fsli li];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
546 ylabelr = 'real'; ylabeli = 'imag';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
547 yscaleR = 'lin'; yscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
548 xscaleR = 'log'; xscaleI = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
549 case 'absdeg'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
550 a = abs(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
551 p = utils.math.phase(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
552 % if the data are absolute values, then we don't expect
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
553 % negative error bars
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
554 idx = find(yl>abs(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
555 yl(idx) = 0.999*abs(y(idx));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
556 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
557 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
558 li = errorbar(fsax_r, x, a, yl, yu);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
559 le = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
560 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
561 li = feval(type, fsax_r, x, abs(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
562 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
563 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
564 lhs = errorbarxy(fsax_r, x, abs(y), xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
565 li = lhs(1); le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
566 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
567 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
568 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
569 ferr = yl./a;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
570 yl = 360.*ferr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
571 yu = 360.*ferr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
572 li = [li errorbar(fsax_i, x, p, yl, yu)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
573 le = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
574 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
575 li = [li feval(type, fsax_i, x, utils.math.phase(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
576 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
577 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
578 lhs = errorbarxy(fsax_i, x, utils.math.phase(y), xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
579 li = [li lhs(1)]; le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
580 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
581 fsli = [fsli li];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
582 ylabelr = 'Amplitude'; ylabeli = 'Phase';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
583 yscaleR = 'log'; yscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
584 xscaleR = 'log'; xscaleI = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
585 case 'absrad'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
586 % if the data are absolute values, then we don't expect
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
587 % negative error bars
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
588 idx = find(yl>abs(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
589 yl(idx) = 0.999*abs(y(idx));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
590 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
591 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
592 li = errorbar(fsax_r, x, abs(y), yl, yu);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
593 le = false; %#ok<*NASGU>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
594 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
595 li = feval(type, fsax_r, x, abs(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
596 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
597 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
598 lhs = errorbarxy(fsax_r, x, abs(y), xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
599 li = lhs(1); le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
600 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
601 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
602 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
603 ferr = yl./abs(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
604 yl = pi.*ferr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
605 yu = pi.*ferr;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
606 li = [li errorbar(fsax_i, x, angle(y), yl, yu)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
607 le = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
608 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
609 li = [li feval(type, fsax_i, x, angle(y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
610 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
611 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
612 lhs = errorbarxy(fsax_i, x, angle(y), xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
613 li = [li lhs(1)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
614 le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
615 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
616 fsli = [fsli li];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
617 ylabelr = 'Amplitude'; ylabeli = 'Phase';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
618 yscaleR = 'log'; yscaleI = 'lin';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
619 xscaleR = 'log'; xscaleI = 'log';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
620 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
621 error('### Unknown plot type for complex data');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
622 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
623 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
624
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
625 %------- Axis properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
626 % axis counter
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
627 c = 1+(jj-1)*2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
628
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
629 % Set real axis ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
630 ylstrR = parseOptions(c, ylabels, ylabelr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
631 ylstrR = prepareAxisLabel(yunits, ymath, ylstrR, 'y', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
632 ylstrR = fixlabel(ylstrR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
633 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
634 ylabel(fsax_r, ylstrR, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
635 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
636 ylabel(fsax_r, ylstrR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
637 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
638
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
639 % Set imag axis ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
640 if ishandle(fsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
641 ylstrI = parseOptions(c+1, ylabels, ylabeli);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
642 switch complexPlotType
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
643 case 'realimag'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
644 ylstrI = prepareAxisLabel(yunits, ymath, ylstrI, 'y', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
645 case 'absdeg'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
646 ylstrI = prepareAxisLabel(unit('deg'), [], ylstrI, 'y', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
647 case 'absrad'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
648 ylstrI = prepareAxisLabel(unit('rad'), [], ylstrI, 'y', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
649 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
650 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
651 ylstrI = fixlabel(ylstrI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
652 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
653 ylabel(fsax_i, ylstrI, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
654 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
655 ylabel(fsax_i, ylstrI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
656 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
657 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
658
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
659 % Set xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
660 xlstr = parseOptions(jj, xlabels, find(pl, 'XLabels'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
661 xlstr = prepareAxisLabel(xunits, xmath, xlstr, 'x', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
662 xlstr = fixlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
663 if isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
664 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
665 xlabel(fsax_r, xlstr, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
666 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
667 xlabel(fsax_r, xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
668 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
669 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
670 % Do not draw Xlabel and XTicklabel on the real plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
671 set(fsax_r, 'XTickLabel',[]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
672 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
673 if ~isempty(fsax_i) && ishandle(fsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
674 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
675 xlabel(fsax_i, xlstr, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
676 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
677 xlabel(fsax_i, xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
678 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
679 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
680
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
681 % Set grid on or off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
682 grid(fsax_r, 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
683 if ~isempty(fsax_i) && ishandle(fsax_i), grid(fsax_i, 'on'); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
684
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
685 % Set Y scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
686 yscaleR = parseOptions(c, yscales, yscaleR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
687 yscaleI = parseOptions(c+1, yscales, yscaleI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
688 set(fsax_r, 'YScale', yscaleR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
689 if ~isempty(fsax_i) && ishandle(fsax_i), set(fsax_i, 'YScale', yscaleI); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
690
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
691 % Set X scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
692 xscaleR = parseOptions(c, xscales, xscaleR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
693 xscaleI = parseOptions(c+1, xscales, xscaleI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
694 set(fsax_r, 'XScale', xscaleR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
695 if ~isempty(fsax_i) && ishandle(fsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
696 set(fsax_i, 'XScale', xscaleI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
697 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
698
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
699 % Set Y range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
700 yrange = parseOptions(c, yranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
701 if ~isempty(yrange)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
702 set(fsax_r, 'YLim', yrange);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
703 elseif strcmpi(yscaleR, 'log')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
704 [tcks,ymin,ymax] = getRealYDataTicks(y, ymin, ymax, complexPlotType, yscaleR);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
705 nticks = numel(tcks);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
706 if nticks>0 && nticks < 10
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
707 yrange = [tcks(1) tcks(end)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
708 set(fsax_r, 'YLim', yrange);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
709 set(fsax_r, 'Ytickmode', 'manual');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
710 set(fsax_r, 'Ytick', tcks);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
711 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
712 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
713 yrange = parseOptions(c+1, yranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
714 if ~isempty(fsax_i) && ishandle(fsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
715 if ~isempty(yrange)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
716 set(fsax_i, 'YLim', yrange);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
717 elseif strcmpi(yscaleI, 'log')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
718
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
719 % This doesn't really make sense since the imaginary part or
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
720 % phase or angle will always contain negative parts. Would the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
721 % user really choose a log scale in that case?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
722 % tcks = getImagYDataTicks(y, ymin, ymax, complexPlotType, yscaleI);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
723 % if ~isempty(tcks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
724 % yrange = [tcks(1) tcks(end)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
725 % set(fsax_i, 'YLim', yrange);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
726 % set(fsax_i, 'Ytickmode', 'manual');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
727 % set(fsax_i, 'Ytick', tcks);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
728 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
729 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
730 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
731
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
732 % Set X range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
733 xrange = parseOptions(c, xranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
734 if ~isempty(xrange)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
735 set(fsax_r, 'XLim', xrange);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
736 elseif strcmpi(xscaleR, 'log')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
737 xmin = min(xmin, floor(log10(min(x(x>0)))));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
738 xmax = max(xmax, ceil(log10(max(x(x>0)))));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
739 tcks = logspace(xmin, xmax, xmax - xmin +1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
740 xrange = [tcks(1) tcks(end)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
741 set(fsax_r, 'XLim', xrange);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
742 set(fsax_r, 'Xtickmode', 'manual');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
743 set(fsax_r, 'Xtick', tcks);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
744 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
745 xrange = parseOptions(c+1, xranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
746 if ~isempty(fsax_i) && ishandle(fsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
747 if ~isempty(xrange)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
748 set(fsax_i, 'XLim', xrange);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
749 elseif strcmpi(xscaleR, 'log')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
750 xmin = min(xmin, floor(log10(min(x(x>0)))));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
751 xmax = max(xmax, ceil(log10(max(x(x>0)))));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
752 tcks = logspace(xmin, xmax, xmax - xmin +1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
753 xrange = [tcks(1) tcks(end)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
754 set(fsax_i, 'XLim', xrange);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
755 set(fsax_i, 'Xtickmode', 'manual');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
756 set(fsax_i, 'Xtick', tcks);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
757 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
758 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
759
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
760 %------- line properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
761 [col, lstyle, lwidth, mkr] = parseLineProps(jj, aos(jj).plotinfo, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
762 linecolors, col, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
763 linestyles, '-', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
764 linewidths, get(0,'DefaultLineLineWidth'), ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
765 markers, 'None');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
766
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
767 % set props
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
768 set(li, 'Color', col);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
769 set(li, 'LineStyle', lstyle);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
770 set(li, 'LineWidth', lwidth);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
771 if numel(x) == 1 && numel(y) == 1 && strcmp(mkr, 'None')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
772 mkr = '.';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
773 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
774 set(li, 'Marker', mkr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
775
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
776 % Set legend string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
777 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
778 if ~isempty(aos(jj).plotinfo) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
779 aos(jj).plotinfo.isparam('LEGEND_ON') && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
780 ~aos(jj).plotinfo.find('LEGEND_ON')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
781 for kk=1:numel(li)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
782 set(get(get(li(kk),'Annotation'),'LegendInformation'),'IconDisplayStyle','off'); % Exclude line from legend
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
783 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
784 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
785 lstr = parseOptions(jj, legends, makeLegendStr(aos(jj)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
786 legendStrR = [legendStrR cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
787 if ~isreal(y)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
788 legendStrI = [legendStrI cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
789 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
790 if strcmp(arrangement, 'single') || strcmp(arrangement, 'subplots')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
791 legend(fsax_r, fixlabel(legendStrR{end}), 'Location', legendLoc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
792 if ~isempty(fsax_i) && ishandle(fsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
793 h = legend(fsax_i, fixlabel(legendStrI), 'Location', legendLoc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
794 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
795 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
796 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
797 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
798
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
799 end % End loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
800
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
801 % Make sure the plots are refreshed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
802 drawnow();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
803 % Trim the size of complex plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
804 for jj = 1:length(complexFig)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
805 p_r = get(complexAxes(2*jj-1), 'Position');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
806 p_i = get(complexAxes(2*jj), 'Position');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
807 dh = (p_r(2) - (p_i(2)+p_i(4)))/3;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
808 set(complexAxes(2*jj-1), 'Position', [p_r(1) p_r(2)-dh p_r(3) p_r(4)+dh]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
809 set(complexAxes(2*jj), 'Position', [p_i(1) p_i(2) p_i(3) p_i(4)+dh]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
810 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
811
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
812 % Process legends for stacked plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
813 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
814 if strcmp(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
815 if ~isempty(legendStrR)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
816 h = legend(fsax_r, fixlabel(legendStrR), 'Location', legendLoc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
817 set(h, 'FontSize', legendsFont);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
818 if ~isempty(fsax_i) && ishandle(fsax_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
819 h = legend(fsax_i, fixlabel(legendStrI), 'Location', legendLoc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
820 set(h, 'FontSize', legendsFont);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
821 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
822 end
|
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 end % End ~isempty AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
826
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
827 % Apply plot settings to the figure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
828 applyPlotSettings(fsax, fsli);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
829
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
830 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
831 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
832 varargout{1} = fsfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
833 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
834 if nargout > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
835 varargout{2} = fsax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
836 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
837 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
838 varargout{3} = fsli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
839 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
840 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
841 error('### Too many output arguments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
842 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
843 end % End fs_plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
844
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
845 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
846 % Plot tsdata and xydata objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
847 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
848 function varargout = xy_plot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
849
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
850 aos = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
851 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
852 fig2plot = varargin{3};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
853 Na = length(aos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
854
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
855 UseLatex = find(pl, 'LatexLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
856 if ischar(UseLatex)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
857 UseLatex = eval(UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
858 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
859
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
860 % Extract parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
861 arrangement = find(pl, 'Arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
862 linecolors = find(pl, 'LineColors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
863 colors = find(pl, 'Colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
864 linestyles = find(pl, 'LineStyles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
865 markers = find(pl, 'Markers');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
866 linewidths = find(pl, 'LineWidths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
867 legends = find(pl, 'Legends');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
868 legendsFont = find(pl, 'LegendFontSize');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
869 ylabels = find(pl, 'YLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
870 xlabels = find(pl, 'XLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
871 xmaths = find(pl, 'XMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
872 ymaths = find(pl, 'YMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
873 yranges = find(pl, 'YRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
874 xranges = find(pl, 'XRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
875 yscales = find(pl, 'YScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
876 xscales = find(pl, 'XScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
877 type = find(pl, 'Function');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
878 legendLoc = find(pl, 'LegendLocation');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
879 xunits = find(pl, 'Xunits');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
880 autoErrors = utils.prog.yes2true(find(pl, 'AUTOERRORS'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
881
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
882 % Convert the colour if it is a character to a cell-string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
883 if ischar(colors)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
884 colors = cellstr(colors);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
885 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
886
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
887 % get errors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
888 XerrL = find(pl, 'XerrL');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
889 XerrU = find(pl, 'XerrU');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
890 YerrL = find(pl, 'YerrL');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
891 YerrU = find(pl, 'YerrU');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
892 if ~iscell(XerrU), XerrU = {XerrU}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
893 if ~iscell(XerrL), XerrL = {XerrL}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
894 if ~iscell(YerrU), YerrU = {YerrU}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
895 if ~iscell(YerrL), YerrL = {YerrL}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
896 if (numel(XerrL) > 1 && numel(XerrL) ~= numel(aos)) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
897 (numel(YerrL) > 1 && numel(YerrL) ~= numel(aos)) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
898 (numel(XerrU) > 1 && numel(XerrU) ~= numel(aos)) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
899 (numel(YerrU) > 1 && numel(YerrU) ~= numel(aos))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
900 error('### Please specify 1 set of errors for all AOs, or a set of errors for each AO.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
901 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
902
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
903 torigin = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
904
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
905 % check whether we want legends or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
906 if iscell(legends)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
907 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
908 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
909 if strcmpi(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
910 legendsOn = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
911 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
912 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
913 legends = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
914 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
915 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
916
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
917 if ~isempty(ymaths) || ~isempty(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
918 warning('The use of the ''ymaths'' and ''xmaths'' parameters is deprecated. Please perform any calculations before calling iplot.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
919 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
920
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
921 if ~iscell(linewidths), linewidths = {linewidths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
922 if ~iscell(linestyles), linestyles = {linestyles}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
923 if ~iscell(linecolors), linecolors = {linecolors}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
924 if ~iscell(markers), markers = {markers}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
925 if ~iscell(legends), legends = {legends}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
926 if ~iscell(ylabels), ylabels = {ylabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
927 if ~iscell(xlabels), xlabels = {xlabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
928 if ~iscell(xmaths), xmaths = {xmaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
929 if ~iscell(ymaths), ymaths = {ymaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
930 if ~iscell(xranges), xranges = {xranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
931 if ~iscell(yranges), yranges = {yranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
932 if ~iscell(xscales), xscales = {xscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
933 if ~iscell(yscales), yscales = {yscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
934 if ~iscell(xunits), xunits = {xunits}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
935
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
936 % collect figure handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
937 tsfig = []; tsax = []; tsli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
938 % Legend holder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
939 legendStr = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
940 if ~isempty(aos)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
941 % Now loop over AOs to get earliest start time
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
942 T0 = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
943 if strcmp(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
944 T0 = 1e50;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
945 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
946 % Get this AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
947 if isa(aos(jj).data, 'tsdata') && aos(jj).data.t0.utc_epoch_milli/1000 < T0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
948 T0 = floor(aos(jj).data.t0.utc_epoch_milli/1000);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
949 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
950 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
951 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
952
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
953 % Do we want to use a unit placeholder on the yaxis?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
954 yunits = aos(1).data.yunits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
955 yunitPlaceholder = '[Mixed]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
956 useYunitPlaceholder = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
957 if strcmpi(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
958 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
959 if yunits ~= aos(jj).data.yunits
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
960 useYunitPlaceholder = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
961 break;
|
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 % Do we want to use a unit placeholder on the xaxis?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
967 firstXunits = aos(1).data.xunits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
968 xunitPlaceholder = '[Mixed]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
969 useXunitPlaceholder = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
970 if strcmpi(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
971 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
972 if firstXunits ~= aos(jj).data.xunits
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
973 useXunitPlaceholder = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
974 break;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
975 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
976 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
977 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
978
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
979 % Now loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
980 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
981 % Get this AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
982 toff = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
983
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
984 if useYunitPlaceholder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
985 yunits = yunitPlaceholder;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
986 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
987 yunits = aos(jj).data.yunits;
|
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 % what figures do we need?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
991 switch arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
992 case 'single'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
993 tsfig = [tsfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
994 tsax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
995 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
996 if isa(aos(jj).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
997 torigin = aos(jj).data.t0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
998 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
999 case 'stacked'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1000 if ~isempty(fig2plot), tsfig = fig2plot;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1001 elseif jj==1, tsfig = figure;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1002 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1003 tsax = subplot(1,1,1,'Parent',tsfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1004 col = colors{mod(jj-1,length(colors))+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1005 hold on;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1006 % deal with time-stamps here
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1007 if isa(aos(jj).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1008 toff = aos(jj).data.t0.utc_epoch_milli/1000 - T0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1009 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1010 toff = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1011 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1012 if isa(aos(jj).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1013 torigin = time(T0);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1014 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1015 case 'subplots'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1016 if ~isempty(fig2plot), tsfig = fig2plot;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1017 elseif jj==1, tsfig = figure;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1018 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1019 tsax = [tsax subplot(Na, 1, jj,'Parent',tsfig)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1020 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1021 if isa(aos(jj).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1022 torigin = aos(jj).data.t0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1023 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1024 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1025 error('### Unknown plot arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1026 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1027
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1028 %------- Apply math functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1029
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1030 % Get data and add t0 offset for this time-series
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1031 x = aos(jj).data.getX + toff;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1032 y = aos(jj).data.getY;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1033
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1034 % Apply any math operations
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1035 ymath = parseOptions(jj, ymaths, 'y'); eval(sprintf('y = %s;', ymath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1036 xmath = parseOptions(jj, xmaths, 'x'); eval(sprintf('x = %s;', xmath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1037
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1038 % Process X units
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1039 if useXunitPlaceholder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1040 xunit = xunitPlaceholder;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1041 dateTicSpec = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1042 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1043 if isa(aos(jj).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1044 xunitIn = char(aos(jj).data.xunits);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1045 xunit = parseOptions(jj, xunits, xunitIn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1046 [x, xunit, dateTicSpec] = convertXunits(x, torigin, xunit, xunitIn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1047 elseif isa(aos(jj).data, 'xydata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1048 xunitIn = char(aos(jj).data.xunits);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1049 xunit = parseOptions(jj, xunits, xunitIn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1050 dateTicSpec = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1051 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1052 xunit = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1053 dateTicSpec = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1054 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1055 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1056
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1057 % Process errors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1058 [fcn, xu, xl, yu, yl] = process_errors(jj, size(y), type, XerrU, XerrL, YerrU, YerrL, aos(jj), autoErrors);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1059
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1060 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1061
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1062 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1063 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1064 li = errorbar(tsax(end), x, y, yl, yu);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1065 le = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1066 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1067 li = feval(type, tsax(end), x, y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1068 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1069 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1070 lhs = errorbarxy(tsax(end), x, y, xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1071 li = lhs(1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1072 le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1073 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1074 tsli = [tsli li];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1075 if isa(aos(jj).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1076 title(sprintf('Time origin: %s', char(torigin)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1077 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1078
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1079 %------- Add time origin to the axis handle
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1080
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1081 if isempty(torigin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1082 torigin = time();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1083 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1084
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1085 set(tsax(end), 'UserData', torigin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1086 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1087 dcm_obj = datacursormode(get(tsfig(end),'Parent'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1088 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1089 dcm_obj = datacursormode(tsfig(end));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1090 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1091 set(dcm_obj, 'UpdateFcn', @utils.plottools.datacursormode)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1092
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1093 %---------- Call datetic
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1094 if dateTicSpec
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1095 datetick(tsax(end), 'x', xunit(2:end-1), 'keeplimits');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1096 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1097
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1098 %------- Axis properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1099
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1100 % Set ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1101 ylstr = parseOptions(jj, ylabels, find(pl, 'YLabels'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1102 ylstr = prepareAxisLabel(yunits, ymath, ylstr, 'y', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1103 ylstr = fixlabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1104 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1105 ylabel(ylstr, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1106 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1107 ylabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1108 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1109
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1110 % Set xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1111 xlstr = parseOptions(jj, xlabels, find(pl, 'XLabels'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1112 xlstr = prepareAxisLabel(xunit, xmath, xlstr, 'x', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1113 xlstr = fixlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1114 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1115 xlabel(xlstr, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1116 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1117 xlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1118 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1119
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1120 % Set Y range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1121 yrange = parseOptions(jj, yranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1122 if ~isempty(yrange), set(tsax(end), 'YLim', yrange); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1123
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1124 % Set X range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1125 xrange = parseOptions(jj, xranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1126 if ~isempty(xrange), set(tsax(end), 'XLim', xrange); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1127
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1128 % Set Y scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1129 yscale = parseOptions(jj, yscales, 'lin');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1130 set(tsax(end), 'YScale', yscale);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1131
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1132 % Set X scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1133 xscale = parseOptions(jj, xscales, 'lin');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1134 set(tsax(end), 'XScale', xscale);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1135
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1136 % Set grid on or off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1137 grid(tsax(end), 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1138
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1139
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1140 %------- line properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1141 [col, lstyle, lwidth, mkr] = parseLineProps(jj, aos(jj).plotinfo, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1142 linecolors, col, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1143 linestyles, '-', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1144 linewidths, get(0,'DefaultLineLineWidth'), ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1145 markers, 'None');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1146
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1147
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1148 % Set line color
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1149 set(li, 'Color', col);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1150 if ~isempty(le) && ishandle(le), set(le, 'Color', col); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1151 % Set line style
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1152 set(li, 'LineStyle', lstyle);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1153 if ishandle(le), set(le, 'LineStyle', lstyle); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1154 % Set markers
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1155 if numel(x) == 1 && numel(y) == 1 && strcmp(mkr, 'None')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1156 mkr = '.';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1157 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1158 set(li, 'Marker', mkr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1159 % Set line widths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1160 set(li, 'LineWidth', lwidth);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1161 if ~isempty(le) && ishandle(le), set(le, 'LineWidth', lwidth); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1162
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1163 % Set legend string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1164 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1165 if ~isempty(aos(jj).plotinfo) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1166 aos(jj).plotinfo.isparam('LEGEND_ON') && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1167 ~aos(jj).plotinfo.find('LEGEND_ON')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1168 for kk=1:numel(li)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1169 set(get(get(li(kk),'Annotation'),'LegendInformation'),'IconDisplayStyle','off'); % Exclude line from legend
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1170 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1171 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1172 lstr = parseOptions(jj, legends, makeLegendStr(aos(jj)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1173 legendStr = [legendStr cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1174 % Set the legend now if we can
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1175 if strcmp(arrangement, 'single') || strcmp(arrangement, 'subplots')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1176 legend(fixlabel(legendStr{end}), 'Location', legendLoc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1177 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1178 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1179 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1180 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1181
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1182 % Process legends for stacked plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1183 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1184 if strcmp(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1185 if ~isempty(legendStr)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1186 h = legend(fixlabel(legendStr), 'Location', legendLoc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1187 set(h, 'FontSize', legendsFont);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1188 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1189 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1190 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1191 end % End if empty AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1192
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1193 % Apply plot settings to the figure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1194 applyPlotSettings(tsax, tsli);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1195
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1196 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1197 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1198 varargout{1} = tsfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1199 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1200 if nargout > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1201 varargout{2} = tsax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1202 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1203 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1204 varargout{3} = tsli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1205 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1206 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1207 error('### Too many output arguments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1208 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1209 end % end xy_plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1210
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1211
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1212 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1213 % Plot cdata objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1214 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1215 function varargout = y_plot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1217 aos = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1218 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1219 fig2plot = varargin{3};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1220
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1221 UseLatex = find(pl, 'LatexLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1222 if ischar(UseLatex)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1223 UseLatex = eval(UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1224 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1225
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1226 % Extract parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1227 arrangement = find(pl, 'Arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1228 linecolors = find(pl, 'LineColors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1229 colors = find(pl, 'Colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1230 linestyles = find(pl, 'LineStyles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1231 markers = find(pl, 'Markers');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1232 linewidths = find(pl, 'LineWidths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1233 legends = find(pl, 'Legends');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1234 legendsFont = find(pl, 'LegendFontSize');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1235 ylabels = find(pl, 'YLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1236 xlabels = find(pl, 'XLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1237 xmaths = find(pl, 'XMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1238 ymaths = find(pl, 'YMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1239 yranges = find(pl, 'YRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1240 xranges = find(pl, 'XRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1241 yscales = find(pl, 'YScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1242 xscales = find(pl, 'XScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1243 type = find(pl, 'Function');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1244 legendLoc = find(pl, 'LegendLocation');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1245 autoErrors = find(pl, 'AUTOERRORS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1246
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1247 % Convert the colour if it is a character to a cell-string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1248 if ischar(colors)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1249 colors = cellstr(colors);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1250 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1251
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1252 % get errors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1253 YerrL = find(pl, 'YerrL');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1254 YerrU = find(pl, 'YerrU');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1255 if ~iscell(YerrU), YerrU = {YerrU}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1256 if ~iscell(YerrL), YerrL = {YerrL}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1257 if (numel(YerrL) > 1 && numel(YerrL) ~= numel(aos)) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1258 (numel(YerrU) > 1 && numel(YerrU) ~= numel(aos))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1259 error('### Please specify 1 set of errors for all AOs, or a set of errors for each AO.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1260 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1261
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1262 % check whether we want legends or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1263 if iscell(legends)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1264 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1265 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1266 if strcmp(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1267 legendsOn = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1268 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1269 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1270 legends = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1271 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1272 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1273
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1274 if ~isempty(ymaths) || ~isempty(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1275 warning('The use of the ''ymaths'' and ''xmaths'' parameters is deprecated. Please perform any calculations before calling iplot.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1276 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1277
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1278 if ~iscell(linewidths), linewidths = {linewidths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1279 if ~iscell(linestyles), linestyles = {linestyles}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1280 if ~iscell(linecolors), linecolors = {linecolors}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1281 if ~iscell(markers), markers = {markers}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1282 if ~iscell(legends), legends = {legends}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1283 if ~iscell(ylabels), ylabels = {ylabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1284 if ~iscell(xlabels), xlabels = {xlabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1285 if ~iscell(xmaths), xmaths = {xmaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1286 if ~iscell(ymaths), ymaths = {ymaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1287 if ~iscell(xranges), xranges = {xranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1288 if ~iscell(yranges), yranges = {yranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1289 if ~iscell(xscales), xscales = {xscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1290 if ~iscell(yscales), yscales = {yscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1291
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1292 % collect figure handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1293 cfig = []; cax = []; cli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1294 % Legend holder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1295 legendStr = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1296 if ~isempty(aos)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1297
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1298 % Now loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1299 Na = length(aos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1300
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1301 % Do we want to use a unit placeholder on the yaxis?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1302 yunits = aos(1).data.yunits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1303 yunitPlaceholder = '[Mixed]';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1304 useYunitPlaceholder = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1305 if strcmpi(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1306 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1307 if yunits ~= aos(jj).data.yunits
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1308 useYunitPlaceholder = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1309 break;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1310 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1311 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1312 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1313
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1314 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1315 if useYunitPlaceholder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1316 yunits = yunitPlaceholder;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1317 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1318 yunits = aos(jj).data.yunits;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1319 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1320
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1321 % what figures do we need?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1322 switch arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1323 case 'single'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1324 cfig = [cfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1325 cax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1326 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1327 case 'stacked'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1328 if ~isempty(fig2plot), cfig = fig2plot;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1329 elseif jj==1, cfig = figure;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1330 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1331 % if jj==1, cfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1332 cax = subplot(1,1,1,'Parent',cfig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1333 col = colors{mod(jj-1,length(colors))+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1334 hold on;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1335 case 'subplots'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1336 if ~isempty(fig2plot), cfig = fig2plot;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1337 elseif jj==1, cfig = figure;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1338 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1339 % if jj == 1, cfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1340 cax = [cax subplot(Na, 1, jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1341 col = colors{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1342 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1343 error('### Unknown plot arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1344 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1345
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1346 % Get data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1347 if isreal(aos(jj).data.getY)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1348 x = 1:length(aos(jj).data.getY);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1349 y = aos(jj).data.getY;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1350 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1351 x = real(aos(jj).data.getY);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1352 y = imag(aos(jj).data.getY);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1353 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1354
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1355 %------- Apply math functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1356 ymath = parseOptions(jj, ymaths, 'y'); eval(sprintf('y = %s;', ymath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1357 xmath = parseOptions(jj, xmaths, 'x'); eval(sprintf('x = %s;', xmath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1358 % Process errors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1359 [fcn, xu, xl, yu, yl] = process_errors(jj, size(y), type, {[]}, {[]}, YerrU, YerrL, aos(jj), autoErrors);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1360
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1361 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1362 switch fcn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1363 case 'errorbar'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1364 lhs = errorbarxy(cax(end), x, y,zeros(size(yl)),yu,zeros(size(yl)),yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1365 idcs = lhs(1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1366 le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1367 case type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1368 idcs = feval(type, cax(end), x, y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1369 le = false; % we have no error plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1370 case 'errorbarxy'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1371 lhs = errorbarxy(cax(end), x, y, xu, yu, xl, yl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1372 idcs = lhs(1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1373 le = lhs(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1374 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1375 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1376 % idcs = feval(type, cax(end), x, y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1377 % cli = [cli idcs(1:end).'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1378
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1379 %------- Axis properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1380
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1381 % Set ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1382 ylstr = parseOptions(jj, ylabels, find(pl, 'YLabels'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1383 ylstr = prepareAxisLabel(yunits, ymath, ylstr, 'y', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1384 ylstr = fixlabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1385 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1386 ylabel(ylstr, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1387 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1388 ylabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1389 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1390
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1391 % Set xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1392 xlstr = parseOptions(jj, xlabels, find(pl, 'XLabels'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1393 xlstr = prepareAxisLabel(unit('Index'), xmath, xlstr, 'x', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1394 xlstr = fixlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1395 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1396 xlabel(xlstr, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1397 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1398 xlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1399 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1400
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1401 % Set Y scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1402 yscale = parseOptions(jj, yscales, 'lin');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1403 set(cax(end), 'YScale', yscale);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1404
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1405 % Set X scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1406 xscale = parseOptions(jj, xscales, 'lin');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1407 set(cax(end), 'XScale', xscale);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1408
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1409 % Set Y range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1410 yrange = parseOptions(jj, yranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1411 if ~isempty(yrange), set(cax(end), 'YLim', yrange); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1412
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1413 % Set X range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1414 xrange = parseOptions(jj, xranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1415 if ~isempty(xrange), set(cax(end), 'XLim', xrange); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1416
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1417 % Set grid on or off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1418 grid(cax(end), 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1419
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1420 %------- line properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1421
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1422 [col, lstyle, lwidth, mkr] = parseLineProps(jj, aos(jj).plotinfo, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1423 linecolors, col, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1424 linestyles, '-', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1425 linewidths, get(0,'DefaultLineLineWidth'), ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1426 markers, 'None');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1427
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1428 % Overide line colors with user defined colors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1429 set(idcs, 'Color', col);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1430 if ~isempty(le) && ishandle(le), set(le, 'Color', col); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1431
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1432 % Set line style
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1433 set(idcs, 'LineStyle', lstyle);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1434 if ishandle(le), set(le, 'LineStyle', lstyle); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1435 % Set Markers
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1436 if numel(x) == 1 && numel(y) == 1 && strcmp(mkr, 'None')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1437 mkr = '.';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1438 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1439 set(idcs, 'Marker', mkr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1440 % Set line widths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1441 set(idcs, 'LineWidth', lwidth);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1442 if ~isempty(le) && ishandle(le), set(le, 'LineWidth', lwidth); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1443
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1444 % Set legend string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1445 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1446 if ~isempty(aos(jj).plotinfo) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1447 aos(jj).plotinfo.isparam('LEGEND_ON') && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1448 ~aos(jj).plotinfo.find('LEGEND_ON')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1449 for kk=1:numel(li)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1450 set(get(get(li(kk),'Annotation'),'LegendInformation'),'IconDisplayStyle','off'); % Exclude line from legend
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1451 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1452 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1453 lstr = parseOptions(jj, legends, makeLegendStr(aos(jj)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1454 legendStr = [legendStr cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1455 % Set the legend now if we can
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1456 if strcmp(arrangement, 'single') || strcmp(arrangement, 'subplots')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1457 legend(fixlabel(legendStr{end}), 'Location', legendLoc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1458 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1459 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1460 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1461 end % End AO loop
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1462
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1463 % Process legends for stacked plots
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1464 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1465 if strcmp(arrangement, 'stacked')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1466 if ~isempty(legendStr)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1467 h = legend(fixlabel(legendStr), 'Location', legendLoc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1468 set(h, 'FontSize', legendsFont);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1469 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1470 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1471 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1472
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1473 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1474
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1475 % Apply plot settings to the figure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1476 applyPlotSettings(cax, cli);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1477
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1478 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1479 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1480 varargout{1} = cfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1481 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1482 if nargout > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1483 varargout{2} = cax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1484 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1485 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1486 varargout{3} = cli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1487 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1488 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1489 error('### Too many output arguments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1490 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1491 end % End y_plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1492
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1493 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1494 % Plot xyzdata objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1495 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1496 function varargout = xyz_plot(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1497
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1498 aos = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1499 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1500 fig2plot = varargin{3};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1501
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1502 UseLatex = find(pl, 'LatexLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1503 if ischar(UseLatex)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1504 UseLatex = eval(UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1505 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1506
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1507 % Extract parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1508 arrangement = find(pl, 'Arrangement');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1509 legends = find(pl, 'Legends');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1510 legendsFont = find(pl, 'LegendFontSize');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1511 zlabels = find(pl, 'ZLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1512 ylabels = find(pl, 'YLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1513 xlabels = find(pl, 'XLabels');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1514 xmaths = find(pl, 'XMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1515 ymaths = find(pl, 'YMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1516 zmaths = find(pl, 'ZMaths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1517 legendLoc = find(pl, 'LegendLocation');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1518 yranges = find(pl, 'YRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1519 xranges = find(pl, 'XRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1520 zranges = find(pl, 'ZRanges');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1521 zscales = find(pl, 'ZScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1522 yscales = find(pl, 'YScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1523 xscales = find(pl, 'XScales');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1524 invertY = find(pl, 'InvertY');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1525
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1526 % check whether we want legends or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1527 if iscell(legends)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1528 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1529 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1530 if strcmp(legends, 'off')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1531 legendsOn = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1532 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1533 legendsOn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1534 legends = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1535 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1536 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1537
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1538 if ~isempty(ymaths) || ~isempty(xmaths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1539 warning('The use of the ''ymaths'' and ''xmaths'' parameters is deprecated. Please perform any calculations before calling iplot.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1540 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1541
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1542 if ~iscell(legends), legends = {legends}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1543 if ~iscell(ylabels), ylabels = {ylabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1544 if ~iscell(xlabels), xlabels = {xlabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1545 if ~iscell(zlabels), zlabels = {zlabels}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1546 if ~iscell(xmaths), xmaths = {xmaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1547 if ~iscell(ymaths), ymaths = {ymaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1548 if ~iscell(zmaths), zmaths = {zmaths}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1549 if ~iscell(xranges), xranges = {xranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1550 if ~iscell(yranges), yranges = {yranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1551 if ~iscell(zranges), zranges = {zranges}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1552 if ~iscell(xscales), xscales = {xscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1553 if ~iscell(yscales), yscales = {yscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1554 if ~iscell(zscales), zscales = {zscales}; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1555
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1556
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1557 % collect figure handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1558 tdfig = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1559 tdax = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1560 tdli = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1561
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1562 % Legend holder
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1563 legendStr = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1564
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1565 if ~isempty(aos)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1566
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1567 % Now loop over AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1568 Na = length(aos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1569 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1570 % what figures do we need?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1571 switch arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1572 case 'single'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1573 tdfig = [tdfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1574 tdax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1575 case 'subplots'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1576 if ~isempty(fig2plot), tdfig = fig2plot;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1577 elseif jj==1, tdfig = figure;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1578 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1579 % if jj == 1, tdfig = figure; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1580 tdax = [tdax subplot(Na, 1, jj)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1581 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1582 warning('!!! Plot arrangement ''%s'' not supported on XYZ plots. Using ''single'' instead.', arrangement);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1583 arrangment = 'single';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1584 tdfig = [tdfig figure];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1585 tdax = subplot(1,1,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1586 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1587
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1588 %------- Apply math functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1589 x = aos(jj).data.x;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1590 y = aos(jj).data.getY;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1591 z = aos(jj).data.z;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1592
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1593 ymath = parseOptions(jj, ymaths, 'y'); eval(sprintf('y = %s;', ymath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1594 xmath = parseOptions(jj, xmaths, 'x'); eval(sprintf('x = %s;', xmath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1595 zmath = parseOptions(jj, zmaths, 'z'); eval(sprintf('z = %s;', zmath));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1596
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1597 %------- Plot the data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1598
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1599 idcs = pcolor(x,y,z);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1600 tdli = [tdli idcs(1:end).'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1601
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1602 % plot properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1603 set(idcs, 'EdgeColor', 'none');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1604
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1605 %------- Axis properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1606
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1607 % Reverse y-direction for spectrograms
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1608 if invertY
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1609 set(tdax(end), 'YDir', 'reverse');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1610 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1611
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1612 % Set ylabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1613 ylstr = parseOptions(jj, ylabels, find(pl, 'YLabels'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1614 ylstr = prepareAxisLabel(aos(jj).data.yunits, ymath, ylstr, 'y', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1615 ylstr = fixlabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1616 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1617 ylabel(ylstr, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1618 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1619 ylabel(ylstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1620 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1621
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1622 % Set xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1623 xlstr = parseOptions(jj, xlabels, find(pl, 'XLabels'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1624 xlstr = prepareAxisLabel(aos(jj).data.xunits, xmath, xlstr, 'x', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1625 xlstr = fixlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1626 if UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1627 xlabel(xlstr, 'interpreter', 'latex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1628 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1629 xlabel(xlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1630 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1631
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1632 % Set grid on or off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1633 grid(tdax(end), 'on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1634
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1635 % Set title string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1636 if legendsOn
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1637 if ~isempty(aos(jj).plotinfo) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1638 aos(jj).plotinfo.isparam('LEGEND_ON') && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1639 ~aos(jj).plotinfo.find('LEGEND_ON')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1640 for kk=1:numel(li)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1641 set(get(get(li(kk),'Annotation'),'LegendInformation'),'IconDisplayStyle','off'); % Exclude line from legend
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1642 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1643 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1644 lstr = parseOptions(jj, legends, makeLegendStr(aos(jj)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1645 legendStr = [legendStr cellstr(lstr)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1646 % Set the legend now if we can
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1647 title(legendStr{end});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1648 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1649 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1650
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1651 % Set colorbars
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1652 hc = colorbar('peer', tdax(end));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1653 zlstr = parseOptions(jj, zlabels, find(pl, 'Zlabels'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1654 zlstr = prepareAxisLabel(aos(jj).data.zunits, zmath, zlstr, 'z', UseLatex);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1655 zlstr = fixlabel(zlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1656 ylh = get(hc, 'YLabel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1657 set(ylh, 'String', zlstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1658 set(ylh, 'Fontsize', get(tdax(end), 'Fontsize'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1659 set(ylh, 'FontName', get(tdax(end), 'FontName'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1660 set(ylh, 'FontAngle', get(tdax(end), 'FontAngle'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1661 set(ylh, 'FontWeight', get(tdax(end), 'FontWeight'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1662
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1663
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1664 % Set Y scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1665 yscale = parseOptions(jj, yscales, 'lin');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1666 set(tdax(end), 'YScale', yscale);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1667
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1668 % Set X scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1669 xscale = parseOptions(jj, xscales, 'lin');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1670 set(tdax(end), 'XScale', xscale);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1671
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1672 % Set Z scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1673 zscale = parseOptions(jj, zscales, 'lin');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1674 set(tdax(end), 'ZScale', zscale);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1675
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1676 % Set Y range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1677 yrange = parseOptions(jj, yranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1678 if ~isempty(yrange), set(tdax(end), 'YLim', yrange); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1679
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1680 % Set X range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1681 xrange = parseOptions(jj, xranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1682 if ~isempty(xrange), set(tdax(end), 'XLim', xrange); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1683
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1684 % Set Z range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1685 zrange = parseOptions(jj, zranges, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1686 if ~isempty(zrange), set(tdax(end), 'CLim', zrange); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1687 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1688 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1689
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1690 % Apply plot settings to the figure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1691 applyPlotSettings(tdax, tdli);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1692
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1693 % Set outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1694 if nargout > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1695 varargout{1} = tdfig;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1696 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1697 if nargout > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1698 varargout{2} = tdax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1699 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1700 if nargout == 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1701 varargout{3} = tdli;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1702 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1703 if nargout > 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1704 error('### Too many output arguments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1705 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1706 end % end xyz_plot
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1707
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1708 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1709 % Get Info Object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1710 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1711 function ii = getInfo(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1712 if nargin == 1 && strcmpi(varargin{1}, 'None')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1713 sets = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1714 pl = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1715 elseif nargin == 1&& ~isempty(varargin{1}) && ischar(varargin{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1716 sets{1} = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1717 pl = getDefaultPlist(sets{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1718 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1719 sets = {'Time-series Plot', 'Frequency-series Plot', 'Y Data Plot', 'X-Y Data Plot', '3D Plot'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1720 % get plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1721 pl(size(sets)) = plist;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1722 for k = 1:numel(sets)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1723 pl(k) = getDefaultPlist(sets{k});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1724 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1725 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1726 % Build info object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1727 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.output, '$Id: iplot.m,v 1.139 2011/06/01 13:08:47 hewitson Exp $', sets, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1728 ii.setModifier(false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1729 ii.setOutmin(0);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1730 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1731
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1732 % Parse line properties from plist, or defaults
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1733 function [col, lstyle, lwidth, mkr] = parseLineProps(jj, pli, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1734 linecolors, dcol, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1735 linestyles, dlstyle, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1736 linewidths, dlwidth, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1737 markers, dmkr)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1738
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1739 if isempty(pli)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1740 pli = plist;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1741 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1742
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1743 % Set line color but overide with user colors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1744 col = pli.find('color');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1745 if isempty(col)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1746 col = parseOptions(jj, linecolors, dcol);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1747 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1748
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1749 % Set line style
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1750 lstyle = pli.find('linestyle');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1751 if isempty(lstyle)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1752 lstyle = parseOptions(jj, linestyles, dlstyle);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1753 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1754
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1755 % Set line widths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1756 lwidth = pli.find('linewidth');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1757 if isempty(lwidth)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1758 lwidth = parseOptions(jj, linewidths, dlwidth);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1759 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1760
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1761 % Set markers
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1762 mkr = pli.find('marker');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1763 if isempty(mkr)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1764 mkr = parseOptions(jj, markers, dmkr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1765 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1766
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1767 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1768
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1769
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1770 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1771 % Get Default Plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1772 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1773 function plout = getDefaultPlist(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1774 persistent pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1775 persistent lastset;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1776 if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1777 pl = buildplist(set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1778 lastset = set;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1779 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1780 pl.pset('LEGENDFONTSIZE', LTPDAprefs.legendFontSize);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1781 plout = pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1782 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1783
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1784 function out = buildplist(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1785
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1786 % Get the LTPDA color set for lines
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1787 colors = getappdata(0,'ltpda_default_plot_colors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1788
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1789 out = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1790
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1791 % Figure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1792 p = param({'Figure',['The handle of the figure to plot in to. This will be ignored if the AOs to plot are inconsistent,<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1793 'containing different class of data (such as tsdata and fsdata), or if the ''arrangement''<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1794 'parameter is passed as ''single''.']}, paramValue.EMPTY_DOUBLE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1795 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1796
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1797 % Colors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1798 p = param({'Colors', 'A list of colors which will be cycled through for each line in a plot.'}, colors);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1799 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1800
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1801 % Arrangement
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1802 p = param({'Arrangement',['Select the plot layout:<ul>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1803 '<li>''single'' - plot all AOs on individual figures</li>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1804 '<li>''stacked'' - plot all AOs on the same axes</li>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1805 '<li>''subplots'' - plot all AOs on subplots</li>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1806 '</ul>']}, {1, {'stacked', 'single', 'subplots'}, paramValue.SINGLE});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1807 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1808
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1809 % Function
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1810 p = param({'Function',['Specify the plot function:<ul>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1811 '<li>''plot''</li>', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1812 '<li>''stairs''</li>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1813 '<li>''stem''</li>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1814 '</ul>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1815 '[*** doesn''t work for xyzdata AOs]']}, {1, {'plot', 'stairs', 'stem'}, paramValue.SINGLE});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1816 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1817
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1818 % LineColors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1819 p = param({'LineColors', ['A cell-array of color definitions, one for each trace.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1820 'Give an empty string to use the default color.']}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1821 {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1822 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1823
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1824 % LineColors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1825 p = param({'LineStyles', ['A cell-array of line styles, one for each trace.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1826 'Give an empty string to use the default style.']}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1827 {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1828 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1829
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1830 % Markers
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1831 p = param({'Markers', ['A cell-array of markers, one for each trace.']}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1832 {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1833 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1834
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1835 % LineWidths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1836 p = param({'LineWidths', ['A cell-array of line widths, one for each trace.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1837 'Give an empty string to use the default line width.']}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1838 {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1839 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1840
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1841 % Legends
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1842 p = param({'Legends', ['Give a cell-array of strings to be used for<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1843 'the plot legends. If a cell contains an empty<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1844 'string, the default legend string is built.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1845 'If a single string ''off'' is given instead of a<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1846 'cell-array, then the legends are all switched off.']}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1847 {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1848 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1849
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1850 % LegendLocation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1851 p = param({'LegendLocation','Choose the legend location.'}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1852 {5, {'North', 'South', 'East', 'West', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1853 'NorthEast', 'NorthWest', 'SouthEast', 'SouthWest', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1854 'NorthOutside', 'SouthOutside', 'EastOutside', 'WestOutside', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1855 'NorthEastOutside', 'NorthWestOutside', 'SouthEastOutside', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1856 'SouthWestOutside', 'Best', 'BestOutside'}, paramValue.SINGLE});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1857 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1858
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1859 % LegendFontSize
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1860 p = param({'LegendFontSize','Choose the legend font size.'}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1861 {1, {LTPDAprefs.legendFontSize}, paramValue.SINGLE});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1862 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1863
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1864 % XerrL
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1865 p = param({'XerrL','Lower bound error values for the X data points.'}, paramValue.EMPTY_DOUBLE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1866 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1867
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1868 % XerrU
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1869 p = param({'XerrU','Upper bound error values for the X data points.'}, paramValue.EMPTY_DOUBLE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1870 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1871
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1872 % YerrL
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1873 p = param({'YerrL','Lower bound error values for the Y data points.'}, paramValue.EMPTY_DOUBLE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1874 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1875
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1876 % YerrU
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1877 p = param({'YerrU','Upper bound error values for the Y data points.'}, paramValue.EMPTY_DOUBLE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1878 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1879
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1880 % XScales
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1881 p = param({'XScales', ['A cell-array specifying the scale to be used on each x-axis.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1882 'For example, {''lin'', ''log''}']}, {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1883 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1884
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1885 % YScales
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1886 p = param({'YScales', ['A cell-array specifying the scale to be used on each y-axis.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1887 'For example, {''lin'', ''log''}']}, {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1888 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1889
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1890 % XRanges
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1891 p = param({'XRanges', ['A cell-array specifying the ranges to be displayed on each x-axis.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1892 'For example, {[0 1], [-4 4]}.']}, {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1893 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1894
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1895 % YRanges
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1896 p = param({'YRanges', ['A cell-array specifying the ranges to be displayed on each y-axis.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1897 'For example, {[0 1], [-4 4]}.']}, {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1898 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1899
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1900 % LatexLabels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1901 p = param({'LatexLabels','Use latex interpreter for axis labels.'}, paramValue.TRUE_FALSE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1902 p.val.setValIndex(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1903 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1904
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1905 % YMaths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1906 p = param({'YMaths',['Specify math operations to perform on the data vector ''y''. [DEPRECATED]<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1907 'For example, <tt>plist(''Ymaths'', ''sqrt(y)'')</tt>.']}, paramValue.EMPTY_STRING);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1908 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1909
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1910
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1911 % No auto-errors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1912 p = param({'AUTOERRORS',['If the AO contains errors, they will be plotted. You can avoid plotting the <br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1913 'errors by setting this to false.']}, paramValue.FALSE_TRUE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1914 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1915
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1916 switch lower(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1917 case 'frequency-series plot'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1918 % ComplexPlotType
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1919 p = param({'complexPlotType',['Specify how to plot complex data. Choose from:<ul>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1920 '<li>''realimag''</li>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1921 '<li>''absdeg''</li>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1922 '<li>''absrad''</li>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1923 '</ul>']}, {1, {'absdeg', 'realimag', 'absrad'}, paramValue.SINGLE});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1924 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1925
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1926 % Xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1927 p = param({'XLabels',['Specify the labels to be used on the x-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1928 'the data object ''xunits'' property.']}, paramValue.STRING_VALUE('Frequency'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1929 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1930 % ylabels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1931 p = param({'YLabels',['Specify the labels to be used on the y-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1932 'the data object ''yunits'' property.']}, paramValue.STRING_VALUE(''));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1933 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1934
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1935 % XMaths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1936 p = param({'XMaths',['Specify math operations to perform on the data vector ''x''. [DEPRECATED]<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1937 'For example, <tt>plist(''Xmaths'', ''abs(x)'')</tt>.']}, paramValue.EMPTY_STRING);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1938 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1939
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1940 case 'time-series plot'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1941
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1942 % Xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1943 p = param({'XLabels',['Specify the labels to be used on the x-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1944 'the data object ''xunits'' property.']}, paramValue.STRING_VALUE('Time'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1945 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1946
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1947 % Ylabels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1948 p = param({'YLabels',['Specify the labels to be used on the y-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1949 'the data object ''yunits'' property.']}, paramValue.STRING_VALUE('Amplitude'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1950 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1951
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1952 % Xunits
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1953 p = param({'Xunits', ['Specify the units of time on the x-axis as<ul>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1954 '<li>''us'' - microseconds<li>' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1955 '<li>''ms'' - milliseconds<li>' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1956 '<li>''s'' - seconds<li>' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1957 '<li>''m'' - minutes<li>' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1958 '<li>''h'' - hours<li>' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1959 '<li>''D'' - days<li>' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1960 '<li>''M'' - months<li>' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1961 '<li>''HH:MM:SS'' - using a date/time format</li>' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1962 '</ul>']}, {3, {'us', 'ms', 's', 'm', 'h', 'D', 'M', 'HH:MM:SS', 'yyyy-mm-dd HH:MM:SS'}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1963 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1964
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1965 case 'x-y data plot'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1966 % Xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1967 p = param({'XLabels',['Specify the labels to be used on the x-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1968 'the data object ''xunits'' property.']}, paramValue.STRING_VALUE('X-data'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1969 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1970
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1971 % Ylabels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1972 p = param({'YLabels',['Specify the labels to be used on the y-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1973 'the data object ''yunits'' property.']}, paramValue.STRING_VALUE('Y-data'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1974 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1975
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1976 % XMaths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1977 p = param({'XMaths',['Specify math operations to perform on the data vector ''x''. [DEPRECATED]<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1978 'For example, <tt>plist(''Xmaths'', ''abs(x)'')</tt>.']}, paramValue.EMPTY_STRING);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1979 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1980
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1981 case '3d plot'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1982
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1983 out.pset('arrangement', 'single');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1984
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1985 % Xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1986 p = param({'XLabels',['Specify the labels to be used on the x-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1987 'the data object ''xunits'' property.']}, paramValue.STRING_VALUE('Time'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1988 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1989
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1990 % Ylabels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1991 p = param({'YLabels',['Specify the labels to be used on the y-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1992 'the data object ''yunits'' property.']}, paramValue.STRING_VALUE('Frequency'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1993 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1994
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1995 % Zlabels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1996 p = param({'ZLabels',['Specify the labels to be used on the z-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1997 'the data object ''zunits'' property.']}, paramValue.STRING_VALUE('Amplitude'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1998 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1999
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2000 % XMaths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2001 p = param({'XMaths',['Specify math operations to perform on the data vector ''x''. [DEPRECATED]<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2002 'For example, <tt>plist(''Xmaths'', ''abs(x)'')</tt>.']}, paramValue.EMPTY_STRING);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2003 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2004
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2005 % ZMaths
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2006 p = param({'ZMaths',['Specify math operations to perform on the data vector ''z''. [DEPRECATED]<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2007 'For example, <tt>plist(''Zmaths'', ''abs(z)'')</tt>.']}, paramValue.EMPTY_STRING);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2008 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2009
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2010 % ZScales
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2011 p = param({'ZScales', ['A cell-array specifying the scale to be used on each z-axis.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2012 'For example, {''lin'', ''log''}']}, {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2013 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2014
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2015 % ZRanges
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2016 p = param({'ZRanges', ['A cell-array specifying the ranges to be displayed on each z-axis.<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2017 'For example, {[0 1], [-4 4]}.']}, {1, {''}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2018 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2019
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2020 % Invert y-axis
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2021 p = param({'InvertY', ['Invert the y-axis or not.']}, paramValue.TRUE_FALSE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2022 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2023
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2024 out.remove('linestyles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2025 out.remove('linewidths');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2026 out.remove('linecolors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2027 out.remove('markers');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2028
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2029 case 'y data plot'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2030 % Xlabel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2031 p = param({'XLabels',['Specify the labels to be used on the x-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2032 'the data object ''xunits'' property.']}, paramValue.STRING_VALUE('Sample'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2033 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2034
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2035 % Ylabels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2036 p = param({'YLabels',['Specify the labels to be used on the y-axes. The units are added from<br>',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2037 'the data object ''yunits'' property.']}, paramValue.STRING_VALUE('Value'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2038 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2039 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2040 error('### Unknown set [%s]', set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2041 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2042 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2043
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2044
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2045 function name = makeLegendStr(a)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2046
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2047 name = utils.plottools.label(a.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2048 desc = utils.plottools.label(a.description);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2049
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2050 if isempty(name)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2051 name = '?';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2052 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2053
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2054 if ~isempty(desc) && LTPDAprefs.includeDescription
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2055 name = [name ': ' desc];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2056 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2057
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2058
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2059 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2060
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2061 % Perform some substitutions on the labels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2062 function ss = fixlabel(ss)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2063
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2064 MAX_LENGTH = 100;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2065 wasCell = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2066 if ~iscell(ss)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2067 ss = {ss};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2068 wasCell = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2069 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2070
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2071 for kk = 1:numel(ss)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2072 s = ss{kk};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2073 if ~isempty(s)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2074 % Replace all ^(...) with ^{...}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2075 jj = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2076 while jj < numel(s)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2077 if strcmp(s(jj:jj+1), '^(')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2078 % find next )
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2079 for k = 1:numel(s)-jj+1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2080 if s(jj+k) == ')'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2081 s(jj+1) = '{';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2082 s(jj+k) = '}';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2083 break;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2084 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2085 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2086 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2087 jj = jj + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2088 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2089 % Replace all .^ with ^
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2090 s = strrep(s, '.^', '^');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2091
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2092 % reduce size
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2093 if length(s) > MAX_LENGTH
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2094 s = s(1:MAX_LENGTH-3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2095 if s(end) == '\'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2096 s = s(1:end-1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2097 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2098 s = [ s '...' ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2099 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2100
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2101 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2102 ss(kk) = {s};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2103 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2104
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2105 if ~wasCell
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2106 ss = ss{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2107 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2108
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2109 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2110
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2111 %-----------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2112 % Change X data for time-series according to the specified xunits
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2113 function [x, xunit, dateTicSpec] = convertXunits(x, t0, xunit, xunitIn)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2114
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2115 dateTicSpec = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2116
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2117 xunit = strtrim(xunit);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2118 xunitIn = strtrim(xunitIn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2119 if ~strcmpi(strtrim(xunitIn), '[s]')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2120 warning('### I can only convert from [s] to %s - ignoring requested Xunit', xunit);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2121 xunit = xunitIn;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2122 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2123 switch strtrim(xunit)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2124 case {'[us]', 'us'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2125 x = x .* 1e6;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2126 case {'[ms]', 'ms'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2127 x = x .* 1e3;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2128 case {'[s]', 's'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2129 case {'[m]', 'm'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2130 x = x ./ 60;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2131 case {'[h]', 'h'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2132 x = x ./ 3600;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2133 case {'[D]', 'D'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2134 x = x ./ 86400;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2135 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2136 % then we have a datetic spec
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2137 dateTicSpec = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2138 % first convert x data to serial date
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2139 st = format(t0, 'yyyy-mm-dd hh:mm:ss');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2140 st = regexp(st, ' ', 'split');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2141 st = [st{1} ' ' st{2}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2142 t0 = datenum(st); % get t0 as a serial date
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2143 x = t0 + x./86400; % convert x to days
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2144 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2145 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2146 if xunit(1) ~= '['
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2147 xunit = ['[' xunit];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2148 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2149 if xunit(end) ~= ']'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2150 xunit = [xunit ']'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2151 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2152 % 'us' - microseconds
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2153 % 'ms' - milliseconds
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2154 % 's' - seconds [default]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2155 % 'm' - minutes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2156 % 'h' - hours
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2157 % 'D' - days
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2158 % 'M' - months
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2159 % 'HH:MM:SS' - using a date/time format
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2160
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2161 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2162
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2163 %----------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2164 % Prepare an axis label
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2165 function lstr = prepareAxisLabel(units, math, lstr, axis, UseLatex)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2166 if isa(units, 'unit')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2167
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2168 if ismac && UseLatex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2169 units = units.tolabel;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2170 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2171 units = {fixlabel(char(units))};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2172 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2173 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2174 units = {units};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2175 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2176 if ~isempty(math)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2177 if ~isempty(lstr)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2178 lstr = strrep(math, axis, lstr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2179 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2180 lstr = [fixlabel(lstr) ' ' units{1} ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2181 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2182 lstr = [fixlabel(lstr) ' ' units{1}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2183 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2184 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2185
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2186 % Parse cell-array of options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2187 function opt = parseOptions(varargin) %jj, opts, dopt
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2188
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2189 jj = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2190 opts = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2191 dopt = varargin{3};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2192 opt = dopt;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2193
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2194 if ~iscell(opts)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2195 opts = {opts};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2196 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2197 Nopts = numel(opts);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2198
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2199 % First look for the 'all' keyword
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2200 if Nopts == 2 && strcmpi(opts{1}, 'all')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2201 opt = opts{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2202 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2203 if jj <= Nopts && ~isempty(opts{jj})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2204 opt = opts{jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2205 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2206 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2207
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2208 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2209
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2210
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2211
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2212 % ERRORBARXY Customizable error bar plot in X and Y direction
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2213 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2214 % This function allows the user to plot the graph of x against y, along with
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2215 % both x and y errorbars.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2216 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2217 % With 4 numeric arguments (x,y,dx,dy), error bar are assumed to be of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2218 % same magnitude in both direction.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2219 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2220 % One can specify lower and upper error bar with 6 numeric arguments
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2221 % (x,y,dx_high,dy_high,dx_low,dy_low).
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2222 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2223 % x,y,dx,dy,... must be vectors of the same length
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2224 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2225 % [hp he] = errorbarxy(...) returns respectively the handle for the line
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2226 % plot object and the line error bar object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2227 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2228 % It is possible to customize the line properties of the error bars by
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2229 % adding pair of 'field/value' fields (such as 'LineWidth',2) that can be
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2230 % understood by line. See LineProperties for more information.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2231 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2232 % --------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2233 % EXAMPLES
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2234 % --------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2235 % X = 10 * rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2236 % Y = 10 * rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2237 % dx = rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2238 % dy = rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2239 % errorbarxy(X,Y,dx,dy,'Color','k','LineStyle','none','Marker','o',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2240 % 'MarkerFaceColor','w','LineWidth',1,'MarkerSize',11);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2241 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2242 % X = 10 * rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2243 % Y = 10 * rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2244 % dx = rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2245 % dy = rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2246 % dx2 = rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2247 % dy2 = rand(7,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2248 % errorbarxy(X,Y,dx,dy,dx2,dy2,'Color','B','LineStyle','--','Marker','s',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2249 % 'MarkerFaceColor','w','LineWidth',2,'MarkerSize',11);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2250 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2251 % This is a rewrite of the m-file errorbarxy of James Rooney, to add
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2252 % customizable line properties.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2253
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2254 % ------------------ INFO ------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2255 % Authors: Jean-Yves Tinevez
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2256 % Work address: Max-Plank Insitute for Cell Biology and Genetics,
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2257 % Dresden, Germany.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2258 % Email: tinevez AT mpi-cbg DOT de
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2259 % November 2007 - June 2008;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2260 % Permission is given to distribute and modify this file as long as this
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2261 % notice remains in it. Permission is also given to write to the author
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2262 % for any suggestion, comment, modification or usage.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2263 % ------------------ BEGIN CODE ------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2264
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2265 function out = errorbarxy(ax, x,y,varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2266
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2267
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2268 nargs = length(varargin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2269
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2270 for i = 1 : nargs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2271
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2272 if ~( isnumeric(varargin{i}) )
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2273 break
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2274 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2275 errbaropt{i} = varargin{i};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2276
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2277 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2278
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2279
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2280 if i+3 < nargin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2281 displayopt = varargin(i:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2282 if isstruct(displayopt{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2283 options = displayopt{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2284 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2285 options = varargin2struct(displayopt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2286 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2287 erroroptions = options;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2288 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2289 displayopt = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2290 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2291
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2292 options.Color = 'k';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2293 erroroptions.LineStyle = '-';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2294 erroroptions.Marker = 'none';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2295
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2296
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2297 xw = (max(x)-min(x))/100;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2298 yw = (max(y)-min(y))/100;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2299
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2300 n = length(varargin) - length(displayopt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2301
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2302 if n == 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2303 % only 2 cells, so this is the same for lower and upper bar
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2304 ux = errbaropt{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2305 lx = ux;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2306 uy = errbaropt{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2307 ly = uy;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2308
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2309 elseif n == 4
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2310 % 4 cells, the user specified both upper and lower limit
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2311 ux = errbaropt{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2312 lx = errbaropt{3};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2313 uy = errbaropt{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2314 ly = errbaropt{4};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2315
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2316 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2317 errid = 'MATLAB:errorbarxy:BadArgumentNumber';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2318 errmsg = ['Must have 4 or 6 numeric arguments, got ' ,num2str(n+2),'.'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2319 error(errid,errmsg);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2320
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2321 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2322
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2323
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2324 %%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2325
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2326 holdstate = ishold(gca);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2327 X = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2328 Y = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2329 for t = 1:length(x)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2330
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2331 % x errorbars
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2332 X = [ X nan x(t)-lx(t) x(t)+ux(t) nan x(t)-lx(t) x(t)-lx(t) nan x(t)+ux(t) x(t)+ux(t) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2333 Y = [ Y nan y(t) y(t) nan y(t)-yw y(t)+yw nan y(t)-yw y(t)+yw ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2334
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2335 % y errorbars
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2336 X = [ X nan x(t) x(t) nan x(t)-xw x(t)+xw nan x(t)-xw x(t)+xw ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2337 Y = [ Y nan y(t)-ly(t) y(t)+uy(t) nan y(t)-ly(t) y(t)-ly(t) nan y(t)+uy(t) y(t)+uy(t) ];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2338
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2339 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2340
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2341 hold on
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2342 axes(ax);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2343 he = line(X,Y,erroroptions);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2344 hp = plot(ax, x,y,options);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2345 out = [hp he];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2346
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2347 % Return to initial hold state if needed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2348 if ~holdstate
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2349 hold off
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2350 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2351
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2352 function out = varargin2struct(in)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2353 % I hould write help
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2354
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2355 if ~iscell(in)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2356 errid = 'MATLAB:struct2varargin:BadInputType';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2357 errmsg = ['Input argument must be a cell, got a ' ,class(in),'.'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2358 error(errid,errmsg);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2359 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2360
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2361 n = length(in);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2362
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2363 if mod(n,2) ~= 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2364 errid = 'MATLAB:struct2varargin:BadInputType';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2365 errmsg = ['Input argument must have an even number of elements, got ' ,num2str(n),'.'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2366 error(errid,errmsg);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2367 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2368
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2369 out = struct;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2370
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2371 for jj = 1 : n/2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2372 name = in{2*jj-1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2373 value = in{2*jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2374 out.(name) = value;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2375 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2376
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2377 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2378
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2379 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2380
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2381 % Get a suitable ymin and ymax (in logscale) for the given
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2382 % data.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2383 function [ticks,ymin,ymax] = getRealYDataTicks(y, ymin, ymax, complexPlotType, scale)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2384
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2385 ticks = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2386 switch complexPlotType
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2387 case 'realimag'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2388 if strcmpi(scale', 'log')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2389
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2390 % do nothing because it doesn't make sense since we will have
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2391 % negative values on a log scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2392
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2393 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2394 case {'absdeg', 'absrad'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2395
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2396 if strcmpi(scale, 'log')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2397 % This is the main case we want to cover.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2398 ay = abs(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2399 newymin = min(ymin, floor(log10(min(ay(ay>0)))));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2400 newymax = max(ymax, ceil(log10(max(ay(ay>0)))));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2401
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2402 if ~isempty(newymin) && ~isempty(newymax)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2403 ymin = newymin;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2404 ymax = newymax;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2405
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2406 if ymin == ymax
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2407 ymin = floor(log10(min(ay)/10));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2408 ymax = ceil(log10(max(ay)*10));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2409 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2410
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2411 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2412
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2413 if ymin == inf
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2414 ymin = -1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2415 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2416
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2417 if ymax == -inf
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2418 ymax = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2419 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2420
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2421 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2422 nticks = ymax - ymin +1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2423 % can we reduce this if they don't all fit?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2424
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2425 ticks = logspace(ymin, ymax, nticks);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2426 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2427
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2428 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2429 error('### Unknown plot type for complex data');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2430 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2431
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2432 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2433
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2434 % Get a suitable ymin and ymax (in linscale) for the given
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2435 % data.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2436 function ticks = getImagYDataTicks(y, ymin, ymax, complexPlotType, scale)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2437
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2438
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2439 ticks = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2440 switch complexPlotType
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2441 case 'realimag'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2442 if strcmpi(scale', 'log')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2443
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2444 % do nothing because it doesn't make sense since we will have
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2445 % negative values on a log scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2446
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2447 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2448 case 'absdeg'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2449
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2450 if strcmpi(scale', 'log')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2451 % do nothing because it doesn't make sense since we will have
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2452 % negative values on a log scale
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2453 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2454
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2455 case 'absrad'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2456
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2457 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2458 error('### Unknown plot type for complex data');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2459 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2460
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2461
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2462 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2463
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2464
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2465 %-------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2466 % Process errorbars
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2467 function [fcn, xu, xl, yu, yl] = process_errors(jj, dsize, ptype, XerrU, XerrL, YerrU, YerrL, a, auto)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2468
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2469 if numel(XerrL) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2470 xl = XerrL{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2471 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2472 xl = XerrL{jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2473 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2474 if numel(XerrU) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2475 xu = XerrU{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2476 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2477 xu = XerrU{jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2478 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2479 if numel(YerrL) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2480 yl = YerrL{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2481 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2482 yl = YerrL{jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2483 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2484 if numel(YerrU) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2485 yu = YerrU{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2486 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2487 yu = YerrU{jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2488 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2489
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2490 % Check if we have AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2491 if isa(xl, 'ao'), xl = xl.data.getY; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2492 if isa(xu, 'ao'), xu = xu.data.getY; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2493 if isa(yl, 'ao'), yl = yl.data.getY; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2494 if isa(yu, 'ao'), yu = yu.data.getY; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2495
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2496 if isempty(xl) && ~isempty(xu)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2497 xl = xu;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2498 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2499 if isempty(xu) && ~isempty(xl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2500 xu = xl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2501 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2502 if isempty(yl) && ~isempty(yu)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2503 yl = yu;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2504 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2505 if isempty(yu) && ~isempty(yl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2506 yu = yl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2507 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2508
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2509
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2510
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2511 % If the AO has errors, we use them
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2512 if ~isempty(a.dy) && auto
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2513 yl = a.dy;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2514 yu = a.dy;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2515 yu(yu==inf) = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2516 yl(yl==inf) = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2517 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2518
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2519 if isempty(xl) && isempty(xu) && isempty(yu) && isempty(yl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2520 fcn = ptype;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2521 elseif isempty(xl) && isempty(xu)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2522 fcn = 'errorbar';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2523 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2524 fcn = 'errorbarxy';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2525 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2526
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2527 if isempty(xl), xl = zeros(dsize); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2528 if isempty(yl), yl = zeros(dsize); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2529 if isempty(xu), xu = zeros(dsize); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2530 if isempty(yu), yu = zeros(dsize); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2531 if numel(xl) == 1, xl = xl.*ones(dsize); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2532 if numel(xu) == 1, xu = xu.*ones(dsize); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2533 if numel(yu) == 1, yu = yu.*ones(dsize); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2534 if numel(yl) == 1, yl = yl.*ones(dsize); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2535 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2536
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2537 function applyPlotSettings(axesH, lineH)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2538
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2539 prefs = getappdata(0, 'LTPDApreferences');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2540 jPlotPrefs = prefs.getPlotPrefs();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2541
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2542 if jPlotPrefs.getPlotApplyPlotSettings.equals(mpipeline.ltpdapreferences.EnumPlotSetting.IPLOT_ONLY)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2543
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2544 % Set all axes properteis
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2545 for ii =1:numel(axesH)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2546 set(axesH(ii), 'FontSize', double(jPlotPrefs.getPlotDefaultAxesFontSize));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2547 set(axesH(ii), 'LineWidth', double(jPlotPrefs.getPlotDefaultAxesLineWidth));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2548 set(axesH(ii), 'GridLineStyle', char(jPlotPrefs.getPlotDefaultAxesGridLineStyle));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2549 set(axesH(ii), 'MinorGridLineStyle', char(jPlotPrefs.getPlotDefaultAxesMinorGridLineStyle));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2550 switch char(jPlotPrefs.getPlotDefaultAxesFontWeight)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2551 case 'Plain'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2552 set(axesH(ii), 'FontWeight', 'normal');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2553 case 'Bold'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2554 set(axesH(ii), 'FontWeight', 'bold');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2555 case 'Italic'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2556 set(axesH(ii), 'FontWeight', 'light');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2557 case 'Bold Italic'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2558 set(axesH(ii), 'FontWeight', 'demi');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2559 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2560 error('### Unknown value (%s) for the default axes property ''FontWeight''', char(jPlotPrefs.getPlotDefaultAxesFontWeight));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2561 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2562 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2563
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2564 % Set all line properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2565 for ii = 1:numel(lineH)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2566 set(lineH(ii), 'LineWidth', double(jPlotPrefs.getPlotDefaultLineLineWidth));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2567 set(lineH(ii), 'MarkerSize', double(jPlotPrefs.getPlotDefaultLineMarkerSize));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2568 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2569 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2570 end
|