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}) |
|
22 ## Set the current plot window to plot window @var{n}. This function |
|
23 ## currently requires X11 and a version of gnuplot that supports multiple |
4914
|
24 ## frames. If @var{n} is not specified, the next available window |
4912
|
25 ## number is chosen. |
3368
|
26 ## @end deftypefn |
2290
|
27 |
2314
|
28 ## Author: jwe |
|
29 |
3263
|
30 function f = figure (n) |
|
31 |
5406
|
32 __plot_globals__; |
|
33 |
3263
|
34 static figure_list = create_set (0); |
|
35 static figure_called = 0; |
2290
|
36 |
3263
|
37 if (nargin == 0) |
|
38 f = max (figure_list) + 1; |
|
39 else |
|
40 f = n; |
|
41 endif |
|
42 |
|
43 if (nargin < 2) |
5489
|
44 if (isnumeric (f) && f > 0 && round (f) == f) |
|
45 __current_figure__ = f; |
2290
|
46 else |
5489
|
47 error ("figure: expecting positive integer"); |
2290
|
48 endif |
5489
|
49 figure_list = union (figure_list, f); |
3263
|
50 elseif (rem (nargin, 2) == 0) |
|
51 if (! figure_called) |
|
52 figure_called = 1; |
|
53 warning ("figure: setting figure properties is unsupported"); |
|
54 endif |
2290
|
55 else |
|
56 usage ("figure (n)"); |
|
57 endif |
3263
|
58 |
2290
|
59 endfunction |