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 |
2311
|
20 ## usage: mplot (x, y) |
|
21 ## mplot (x1, y1, x2, y2, ...) |
|
22 ## mplot (x, y, fmt) |
|
23 ## |
|
24 ## This is a modified version of plot() command to work with |
|
25 ## multiplot version of gnuplot to plot multiple plots per page. |
|
26 ## This plot version automatically updates the plot position to |
|
27 ## next plot position after making the plot in the given subplot |
|
28 ## position. |
|
29 ## |
|
30 ## See command plot() for the various options to this command |
|
31 ## as this is just mulitplot version of the same command. |
1540
|
32 |
2312
|
33 ## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU> |
|
34 ## Adapted-By: jwe |
1540
|
35 |
2312
|
36 function mplot (...) |
1540
|
37 |
2296
|
38 if (! gnuplot_has_multiplot) |
|
39 error ("mplot: gnuplot does not appear to support this feature"); |
|
40 endif |
|
41 |
2303
|
42 ## global variables to keep track of multiplot options |
1540
|
43 |
3106
|
44 global __multiplot_mode__ = 0; |
|
45 global __multiplot_xsize__; |
|
46 global __multiplot_ysize__; |
|
47 global __multiplot_xn__; |
|
48 global __multiplot_yn__; |
|
49 global __multiplot_xi__; |
|
50 global __multiplot_yi__; |
1540
|
51 |
2520
|
52 gset nologscale; |
|
53 gset nopolar; |
1540
|
54 |
2315
|
55 __plt__ ("plot", all_va_args); |
1540
|
56 |
2303
|
57 ## update the plot position |
1540
|
58 |
3103
|
59 if (__multiplot_mode__) |
1540
|
60 |
3103
|
61 if (__multiplot_xi__ < __multiplot_xn__) |
|
62 __multiplot_xi__++; |
1540
|
63 else |
3103
|
64 __multiplot_xi__ = 1; |
|
65 if (__multiplot_yi__ < multiplot_xn__) |
|
66 __multiplot_yi__++; |
1540
|
67 else |
3103
|
68 __multiplot_yi__ = 1; |
1540
|
69 endif |
|
70 endif |
|
71 |
3103
|
72 xo = (__multiplot_xi__ - 1.0) * __multiplot_xsize__; |
|
73 yo = (__multiplot_yn__ - __multiplot_yi) * __multiplot_ysize__; |
1540
|
74 |
3103
|
75 eval (sprintf ("gset origin %g, %g", xo, yo)); |
1540
|
76 |
3156
|
77 clearplot; |
|
78 |
1540
|
79 endif |
|
80 |
|
81 endfunction |