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. |
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 |
|
25 ## the multiplot version of @code{gnuplot} to plot multiple plots per page. |
|
26 ## This plot version automatically advances to the next subplot position |
|
27 ## after each set of arguments are processed. |
|
28 ## |
|
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 |
2312
|
35 function mplot (...) |
1540
|
36 |
2296
|
37 if (! gnuplot_has_multiplot) |
|
38 error ("mplot: gnuplot does not appear to support this feature"); |
|
39 endif |
|
40 |
2303
|
41 ## global variables to keep track of multiplot options |
1540
|
42 |
3106
|
43 global __multiplot_mode__ = 0; |
|
44 global __multiplot_xsize__; |
|
45 global __multiplot_ysize__; |
|
46 global __multiplot_xn__; |
|
47 global __multiplot_yn__; |
|
48 global __multiplot_xi__; |
|
49 global __multiplot_yi__; |
1540
|
50 |
2520
|
51 gset nologscale; |
|
52 gset nopolar; |
1540
|
53 |
2315
|
54 __plt__ ("plot", all_va_args); |
1540
|
55 |
2303
|
56 ## update the plot position |
1540
|
57 |
3103
|
58 if (__multiplot_mode__) |
1540
|
59 |
3103
|
60 if (__multiplot_xi__ < __multiplot_xn__) |
|
61 __multiplot_xi__++; |
1540
|
62 else |
3103
|
63 __multiplot_xi__ = 1; |
3162
|
64 if (__multiplot_yi__ < __multiplot_yn__) |
3103
|
65 __multiplot_yi__++; |
1540
|
66 else |
3103
|
67 __multiplot_yi__ = 1; |
1540
|
68 endif |
|
69 endif |
|
70 |
3103
|
71 xo = (__multiplot_xi__ - 1.0) * __multiplot_xsize__; |
3162
|
72 yo = (__multiplot_yn__ - __multiplot_yi__) * __multiplot_ysize__; |
1540
|
73 |
3103
|
74 eval (sprintf ("gset origin %g, %g", xo, yo)); |
1540
|
75 |
|
76 endif |
|
77 |
|
78 endfunction |