2847
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
2313
|
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 |
5307
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
2290
|
19 |
3368
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} figure (@var{n}) |
6257
|
22 ## Set the current plot window to plot window @var{n}. If @var{n} is |
|
23 ## not specified, the next available window number is chosen. |
3368
|
24 ## @end deftypefn |
2290
|
25 |
6257
|
26 ## Author: jwe, Bill Denney |
2314
|
27 |
6257
|
28 function h = figure (varargin) |
3263
|
29 |
6257
|
30 nargs = nargin; |
5406
|
31 |
6283
|
32 f = []; |
|
33 |
|
34 if (mod (nargs, 2) == 1) |
6257
|
35 tmp = varargin{1}; |
|
36 if (ishandle (tmp) && strcmp (get (tmp, "type"), "figure")) |
|
37 f = tmp; |
|
38 varargin(1) = []; |
|
39 nargs--; |
|
40 elseif (isnumeric (tmp) && tmp > 0 && round (tmp) == tmp) |
|
41 f = tmp; |
|
42 __uiobject_init_figure__ (f); |
|
43 varargin(1) = []; |
|
44 nargs--; |
|
45 else |
|
46 error ("figure: expecting figure handle or figure number"); |
|
47 endif |
3263
|
48 endif |
|
49 |
6257
|
50 if (rem (nargs, 2) == 0) |
6283
|
51 if (isempty (f)) |
|
52 f = __uiobject_init_figure__ (); |
|
53 endif |
6257
|
54 if (nargs > 0) |
|
55 set (f, varargin{:}); |
2290
|
56 endif |
6257
|
57 __uiobject_adopt__ (0, f); |
|
58 set (0, "currentfigure", f); |
2290
|
59 else |
6046
|
60 print_usage (); |
2290
|
61 endif |
3263
|
62 |
6283
|
63 if (nargout > 0) |
|
64 h = f; |
|
65 endif |
|
66 |
2290
|
67 endfunction |