6257
|
1 ## Copyright (C) 2005 John W. Eaton |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} line (@var{x}, @var{y}) |
|
22 ## @deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}) |
|
23 ## Create line object from @var{x} and @var{y} and insert in current |
|
24 ## axes object. Return handle to line object. |
|
25 ## @end deftypefn |
|
26 |
|
27 ## Author: jwe |
|
28 |
|
29 function h = line (varargin) |
|
30 |
|
31 nargs = nargin; |
|
32 |
|
33 if (nargs > 1) |
|
34 if (isnumeric (varargin{1}) && isnumeric (varargin{2})) |
|
35 ## make a default line object, and make it the current axes for |
|
36 ## the current figure. |
|
37 ca = gca (); |
|
38 s = __uiobject_line_ctor__ (ca); |
|
39 s.xdata = varargin{1}; |
|
40 s.ydata = varargin{2}; |
|
41 num_data_args = 2; |
|
42 if (nargs > 2 && isnumeric (varargin{3})) |
|
43 s.zdata = varargin{3}; |
|
44 num_data_args = 3; |
|
45 endif |
|
46 tmp = __uiobject_make_handle__ (s); |
|
47 if (nargs > num_data_args) |
|
48 set (tmp, varargin{num_data_args+1:end}); |
|
49 endif |
|
50 __uiobject_adopt__ (ca, tmp); |
|
51 if (nargout > 0) |
|
52 h = tmp; |
|
53 endif |
|
54 else |
|
55 error ("expecting numeric arguments for line data"); |
|
56 endif |
|
57 else |
|
58 print_usage (); |
|
59 endif |
|
60 |
|
61 endfunction |