Home > classes > @ao > plot.m

plot

PURPOSE ^

PLOT a simple plot of analysis objects.

SYNOPSIS ^

function varargout = plot(varargin)

DESCRIPTION ^

 PLOT a simple plot of analysis objects.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: PLOT a simple plot of analysis objects.

 CALL:        plot(ao)
              plot(ao,LineSpec)
              plot(axes_handle, ao)
              plot(axes_handle, ao, LineSpec)
              plot(...,'PropertyName',PropertyValue,...)
              [line_h]                   = plot(...)
              [line_h, axes_h]           = plot(...)
              [line_h, axes_h, figure_h] = plot(...)

 VERSION:     $Id: plot.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $

 The following call returns a parameter list object that contains the
 default parameter values:

 >> pl = plot(ao, 'Params')

 The following call returns a string that contains the routine CVS version:

 >> version = plot(ao,'Version')

 The following call returns a string that contains the routine category:

 >> category = plot(ao,'Category')

 HISTORY:      16-08-2007 M Diepholz
                  Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = plot(varargin)
0002 % PLOT a simple plot of analysis objects.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: PLOT a simple plot of analysis objects.
0007 %
0008 % CALL:        plot(ao)
0009 %              plot(ao,LineSpec)
0010 %              plot(axes_handle, ao)
0011 %              plot(axes_handle, ao, LineSpec)
0012 %              plot(...,'PropertyName',PropertyValue,...)
0013 %              [line_h]                   = plot(...)
0014 %              [line_h, axes_h]           = plot(...)
0015 %              [line_h, axes_h, figure_h] = plot(...)
0016 %
0017 % VERSION:     $Id: plot.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $
0018 %
0019 % The following call returns a parameter list object that contains the
0020 % default parameter values:
0021 %
0022 % >> pl = plot(ao, 'Params')
0023 %
0024 % The following call returns a string that contains the routine CVS version:
0025 %
0026 % >> version = plot(ao,'Version')
0027 %
0028 % The following call returns a string that contains the routine category:
0029 %
0030 % >> category = plot(ao,'Category')
0031 %
0032 % HISTORY:      16-08-2007 M Diepholz
0033 %                  Creation
0034 %
0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0036 
0037 VERSION = '$Id: plot.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $';
0038 CATEGORY = 'Output';
0039 
0040   axes_handle = [];
0041   ao_s        = [];
0042   line_spec   = '';
0043   prop_val    = {};
0044   lines_h     = [];
0045 
0046   %%%%%%%%%%   Check if this is a call for parameters   %%%%%%%%%%
0047   if nargin == 2
0048     if isa(varargin{1}, 'ao') && ischar(varargin{2})
0049       in = char(varargin{2});
0050       if strcmp(in, 'Params')
0051         varargout{1} = plist();
0052         return
0053       elseif strcmp(in, 'Version')
0054         varargout{1} = VERSION;
0055         return
0056       elseif strcmp(in, 'Category')
0057         varargout{1} = CATEGORY;
0058         return
0059       end
0060     end
0061   end
0062 
0063   %%%%%%%%%%   Check input values    %%%%%%%%%%
0064   var_argin = varargin;
0065 
0066   while ~isempty(var_argin)
0067     if isempty(var_argin{1})
0068       var_argin = var_argin(2:end);
0069     elseif ishandle(var_argin{1}) & isempty(axes_handle)
0070       axes_handle = var_argin{1};
0071       var_argin = var_argin(2:end);
0072     elseif isa(var_argin{1}, 'ao')
0073       var_argin{1} = reshape(var_argin{1}, 1, []);
0074       ao_s = [ao_s var_argin{1}];
0075       var_argin = var_argin(2:end);
0076     elseif ischar(var_argin{1}) && islinespec(var_argin{1}) && isempty(line_spec)
0077       line_spec = var_argin{1};
0078       var_argin = var_argin(2:end);
0079     else
0080       if length(var_argin) == 1
0081         error('### There is only one propery [%s] without value left', var_argin{1});
0082       elseif length(var_argin) >= 2
0083         prop = var_argin{1};
0084         val  = var_argin{2};
0085         prop_val  = [prop_val, prop, val];
0086         var_argin = var_argin(3:end);
0087       end
0088     end
0089   end
0090 
0091   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0092   %            For all ao_s            %
0093   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0094   for ii = 1:length(ao_s)
0095 
0096     %%%%%%%%%%   Setthe line colors   %%%%%%%%%%
0097     line_colors = getappdata(0, 'ltpda_default_plot_colors');
0098 
0099     %%% Set only the color if the color is not set in the linespec
0100     [res, style] = islinespec(line_spec);
0101 
0102     if isempty(style{3})
0103       prop_val{end+1} = 'Color';
0104       prop_val{end+1} = line_colors{ii};
0105     end
0106 
0107     %%%%%%%%%%   Get the x-, y-values   %%%%%%%%%%
0108     [x,y] = get_xy_values(ao_s(ii).data);
0109 
0110     if isreal(y)
0111       if isempty(x)
0112         x = 1:length(y);
0113       end
0114     else % iscomplex(y)
0115       if isempty(x)
0116         x = real(y);
0117         y = imag(y);
0118       end
0119     end
0120 
0121     %%%%%%%%%%   Call the different plot command lines   %%%%%%%%%%
0122     if ~isempty(axes_handle) && ~isempty(line_spec)
0123       line_h = plot(axes_handle, x, y, line_spec);
0124     elseif ~isempty(axes_handle)
0125       line_h = plot(axes_handle, x, y);
0126     elseif ~isempty(line_spec)
0127       line_h = plot(x, y, line_spec);
0128     else
0129       line_h = plot(x, y);
0130     end
0131 
0132     hold on;
0133 
0134     line_h  = reshape(line_h, 1, []);
0135     lines_h = [lines_h line_h];
0136 
0137     %%%%%%%%%%   Set the different handles: axes- and figure- handle   %%%%%%%%%%
0138     axes_h   = get(line_h(1), 'Parent');
0139     figure_h = get(axes_h,    'Parent');
0140 
0141     %%%%%%%%%%   Set line series Properties OR axes Properties   %%%%%%%%%%
0142     while length(prop_val) >= 2
0143       prop = prop_val{1};
0144       val  = prop_val{2};
0145       prop_val = prop_val(3:end);
0146       if isprop(line_h, prop)
0147         set(line_h, prop, val);
0148       else
0149         if isprop(axes_h, prop)
0150           set(axes_h, prop, val);
0151         else
0152           error('### Invalid line property OR axes property: ''%s''.', prop);
0153         end
0154       end
0155     end
0156 
0157   end % for ii = 1:length(ao_s)
0158 
0159 
0160   %%%%%%%%%%   varargout{1} = line   handle   %%%%%%%%%%
0161   %%%%%%%%%%   varargout{2} = axes   handle   %%%%%%%%%%
0162   %%%%%%%%%%   varargout{3} = figure handle   %%%%%%%%%%
0163   if nargout == 0
0164   elseif nargout == 1
0165     varargout{1} = lines_h;
0166   elseif nargout == 2
0167     varargout{1} = lines_h;
0168     varargout{2} = axes_h;
0169   elseif nargout == 3
0170     varargout{1} = lines_h;
0171     varargout{2} = axes_h;
0172     varargout{3} = figure_h;
0173   else
0174     error('### Unknown number of outputs.')
0175   end
0176 
0177   hold off;
0178 
0179 end % function varargout = plot(varargin)
0180 
0181 
0182 
0183 
0184 
0185 
0186

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003