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. |
1540
|
19 |
3368
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} subwindow (@var{xn}, @var{yn}) |
|
22 ## Sets the subwindow position in multiplot mode for the next plot. The |
|
23 ## multiplot mode has to be previously initialized using the |
|
24 ## @code{multiplot} function, otherwise this command just becomes an alias |
|
25 ## to @code{multiplot} |
|
26 ## @end deftypefn |
1540
|
27 |
2312
|
28 ## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU> |
|
29 ## Created: 3 July 95 |
|
30 ## Adapted-By: jwe |
1540
|
31 |
2312
|
32 function subwindow (xn, yn) |
1540
|
33 |
6163
|
34 __plot_globals__; |
1540
|
35 |
6163
|
36 cf = __current_figure__; |
1540
|
37 |
2303
|
38 ## check calling argument count |
1540
|
39 |
|
40 if (nargin != 2) |
6046
|
41 print_usage (); |
1540
|
42 endif |
|
43 |
2303
|
44 ## check for scalar inputs |
1540
|
45 |
4030
|
46 if (! (isscalar (xn) && isscalar (yn))) |
1540
|
47 error ("subwindow: xn and yn have to be scalars"); |
|
48 endif |
|
49 |
|
50 xn = round (xn); |
|
51 yn = round (yn); |
|
52 |
2303
|
53 ## switch to multiplot mode if not already in, and use the args as the |
2325
|
54 ## args to multiplot() |
1540
|
55 |
6163
|
56 if (! __multiplot_mode__(cf)) |
1557
|
57 multiplot (xn, yn); |
1540
|
58 return; |
|
59 endif |
|
60 |
2303
|
61 ## get the sub plot location |
1540
|
62 |
6163
|
63 if (xn < 1 || xn > __multiplot_xn__(cf) |
|
64 || yn < 1 || yn > __multiplot_yn__(__currrent_figure__)) |
1540
|
65 error ("subwindow: incorrect xn and yn"); |
|
66 endif |
|
67 |
6163
|
68 xo = (xn - 1.0) * __multiplot_xsize__(cf); |
|
69 yo = (__multiplot_yn__(cf) - yn) * __multiplot_ysize__(cf); |
1540
|
70 |
5252
|
71 __gnuplot_raw__ (sprintf ("set origin %g, %g;\n", xo, yo)); |
2325
|
72 |
3156
|
73 clearplot; |
|
74 |
1540
|
75 endfunction |