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 |
|
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
18 ## 02111-1307, 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 |
|
24 ## frames. |
|
25 ## @end deftypefn |
2290
|
26 |
2314
|
27 ## Author: jwe |
|
28 |
3263
|
29 function f = figure (n) |
|
30 |
|
31 static figure_list = create_set (0); |
|
32 static figure_called = 0; |
2290
|
33 |
3263
|
34 if (nargin == 0) |
|
35 f = max (figure_list) + 1; |
|
36 else |
|
37 f = n; |
|
38 endif |
|
39 |
|
40 if (nargin < 2) |
2290
|
41 if (gnuplot_has_frames) |
4790
|
42 gnuterm = getenv ("GNUTERM"); |
|
43 if (isempty (gnuterm) && ! isempty ("DISPLAY")) |
|
44 gnuterm = "x11"; |
|
45 endif |
|
46 if (! isempty (gnuterm)) |
3426
|
47 oneplot (); |
|
48 figure_list = union (figure_list, f); |
4790
|
49 eval (sprintf ("gset term %s %d\n", gnuterm, f)); |
2290
|
50 else |
4790
|
51 error ("figure: requires GNUTERM (Aqua) or DISPLAY (X11)"); |
2290
|
52 endif |
|
53 else |
|
54 error ("figure: gnuplot doesn't appear to support this feature"); |
|
55 endif |
3263
|
56 elseif (rem (nargin, 2) == 0) |
|
57 if (! figure_called) |
|
58 figure_called = 1; |
|
59 warning ("figure: setting figure properties is unsupported"); |
|
60 endif |
2290
|
61 else |
|
62 usage ("figure (n)"); |
|
63 endif |
3263
|
64 |
2290
|
65 endfunction |