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} {} mplot (@var{x}, @var{y}) |
|
22 ## @deftypefnx {Function File} {} mplot (@var{x}, @var{y}, @var{fmt}) |
|
23 ## @deftypefnx {Function File} {} mplot (@var{x1}, @var{y1}, @var{x2}, @var{y2}) |
|
24 ## This is a modified version of the @code{plot} function that works with |
3426
|
25 ## the multiplot version of @code{gnuplot} to plot multiple plots per page. |
3368
|
26 ## This plot version automatically advances to the next subplot position |
|
27 ## after each set of arguments are processed. |
3426
|
28 ## |
3368
|
29 ## See the description of the @var{plot} function for the various options. |
|
30 ## @end deftypefn |
1540
|
31 |
2312
|
32 ## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU> |
|
33 ## Adapted-By: jwe |
1540
|
34 |
3979
|
35 function mplot (varargin) |
1540
|
36 |
2303
|
37 ## global variables to keep track of multiplot options |
1540
|
38 |
3106
|
39 global __multiplot_mode__ = 0; |
|
40 global __multiplot_xsize__; |
|
41 global __multiplot_ysize__; |
|
42 global __multiplot_xn__; |
|
43 global __multiplot_yn__; |
|
44 global __multiplot_xi__; |
|
45 global __multiplot_yi__; |
1540
|
46 |
5252
|
47 __gnuplot_raw__ ("set nologscale;\n"); |
|
48 __gnuplot_raw__ ("set nopolar;\n"); |
1540
|
49 |
3979
|
50 __plt__ ("plot", varargin{:}); |
1540
|
51 |
2303
|
52 ## update the plot position |
1540
|
53 |
3103
|
54 if (__multiplot_mode__) |
1540
|
55 |
3103
|
56 if (__multiplot_xi__ < __multiplot_xn__) |
|
57 __multiplot_xi__++; |
1540
|
58 else |
3103
|
59 __multiplot_xi__ = 1; |
3162
|
60 if (__multiplot_yi__ < __multiplot_yn__) |
3426
|
61 __multiplot_yi__++; |
1540
|
62 else |
3426
|
63 __multiplot_yi__ = 1; |
1540
|
64 endif |
|
65 endif |
|
66 |
3103
|
67 xo = (__multiplot_xi__ - 1.0) * __multiplot_xsize__; |
3162
|
68 yo = (__multiplot_yn__ - __multiplot_yi__) * __multiplot_ysize__; |
1540
|
69 |
5252
|
70 __gnuplot_raw__ (sprintf ("set origin %g, %g;\n", xo, yo)); |
1540
|
71 |
|
72 endif |
|
73 |
|
74 endfunction |