0001 function varargout = plot(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 axes_handle = [];
0030 ao_s = [];
0031 line_spec = '';
0032 prop_val = {};
0033 lines_h = [];
0034
0035
0036 if nargin == 2
0037 if isa(varargin{1}, 'ao') && ischar(varargin{2})
0038 in = char(varargin{1});
0039 if strcmp(in, 'Params')
0040 varargout{1} = plist();
0041 return
0042 end
0043 end
0044 end
0045
0046
0047 for ii = 1:nargin
0048 if ishandle(varargin{ii}) & isempty(axes_handle)
0049 axes_handle = varargin{ii};
0050 elseif isa(varargin{ii}, 'ao')
0051 varargin{ii} = reshape(varargin{ii}, 1, []);
0052 ao_s = [ao_s varargin{ii}];
0053 elseif ischar(varargin{ii}) && islinespec(varargin{ii}) && isempty(line_spec)
0054 line_spec = varargin{ii};
0055 else
0056 prop_val = [prop_val, varargin{ii}];
0057 end
0058 end
0059
0060
0061
0062
0063 for ii = 1:length(ao_s)
0064
0065
0066 line_colors = getappdata(0, 'ltpda_default_plot_colors');
0067
0068
0069 [res, style] = islinespec(line_spec);
0070
0071 if isempty(style{3})
0072 prop_val{end+1} = 'Color';
0073 prop_val{end+1} = line_colors{ii};
0074 end
0075
0076
0077 [x,y] = get_xy_values(ao_s(ii).data);
0078
0079 if isreal(y)
0080 if isempty(x)
0081 x = 1:length(y);
0082 end
0083 else
0084 if isempty(x)
0085 x = real(y);
0086 y = imag(y);
0087 end
0088 end
0089
0090
0091 if ~isempty(axes_handle) && ~isempty(line_spec)
0092 line_h = plot(axes_handle, x, y, line_spec);
0093 elseif ~isempty(axes_handle)
0094 line_h = plot(axes_handle, x, y);
0095 elseif ~isempty(line_spec)
0096 line_h = plot(x, y, line_spec);
0097 else
0098 line_h = plot(x, y);
0099 end
0100
0101 hold on;
0102
0103 line_h = reshape(line_h, 1, []);
0104 lines_h = [lines_h line_h];
0105
0106
0107 axes_h = get(line_h(1), 'Parent');
0108 figure_h = get(axes_h, 'Parent');
0109
0110
0111 while length(prop_val) >= 2
0112 prop = prop_val{1};
0113 val = prop_val{2};
0114 prop_val = prop_val(3:end);
0115 if isprop(line_h, prop)
0116 set(line_h, prop, val);
0117 else
0118 if isprop(axes_h, prop)
0119 set(axes_h, prop, val);
0120 else
0121 error('### Invalid line property OR axes property: ''%s''.', prop);
0122 end
0123 end
0124 end
0125
0126 end
0127
0128
0129
0130
0131
0132 if nargout == 0
0133 elseif nargout == 1
0134 varargout{1} = lines_h;
0135 elseif nargout == 2
0136 varargout{1} = lines_h;
0137 varargout{2} = axes_h;
0138 elseif nargout == 3
0139 varargout{1} = lines_h;
0140 varargout{2} = axes_h;
0141 varargout{3} = figure_h;
0142 else
0143 error('### Unknown number of outputs.')
0144 end
0145
0146 hold off;
0147
0148 end
0149
0150
0151
0152
0153
0154
0155