1540
|
1 # Copyright (C) 1995 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 the |
|
7 # Free Software Foundation; either version 2, or (at your option) any |
|
8 # later version. |
|
9 # |
|
10 # Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # 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. |
|
19 |
|
20 function subwindow (xn, yn) |
|
21 |
|
22 # usage: subwindow (xn, yn) |
|
23 # |
|
24 # NOTE: this will work only with gnuplot installed with |
|
25 # multiplot patch |
|
26 # |
|
27 # Sets subwindow position in multiplot mode for next plot. The |
|
28 # multiplot mode has to be previously initialized using multiplot() |
|
29 # command, else this command just becomes an aliad to multiplot() |
|
30 |
|
31 # Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 |
|
32 |
|
33 # global variables to keep track of multiplot options |
|
34 |
|
35 global multiplot_mode |
1541
|
36 global multiplot_xsize multiplot_ysize |
|
37 global multiplot_xn multiplot_yn |
1540
|
38 |
|
39 # check calling argument count |
|
40 |
|
41 if (nargin != 2) |
|
42 usage ("subwindow (xn, yn)"); |
|
43 endif |
|
44 |
|
45 # check for scalar inputs |
|
46 |
|
47 if (! (is_scalar (xn) && is_scalar (yn))) |
|
48 error ("subwindow: xn and yn have to be scalars"); |
|
49 endif |
|
50 |
|
51 xn = round (xn); |
|
52 yn = round (yn); |
|
53 |
|
54 # switch to multiplot mode if not already in, and use the args as the |
|
55 # args to multiplot() |
|
56 |
|
57 if (multiplot_mode != 1) |
|
58 multiplot (xn, yn) |
|
59 return; |
|
60 endif |
|
61 |
|
62 # get the sub plot location |
|
63 |
1541
|
64 if (xn < 1 || xn > multiplot_xn || yn < 1 || yn > multiplot_yn) |
1540
|
65 error ("subwindow: incorrect xn and yn"); |
|
66 endif |
|
67 |
1541
|
68 xo = (xn - 1.0)*multiplot_xsize; |
|
69 yo = (multiplot_yn - yn)*multiplot_ysize; |
1540
|
70 |
|
71 eval (sprintf ("set origin %g, %g", xo, yo)); |
|
72 |
|
73 endfunction |