2313
|
1 ## Copyright (C) 1996 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 |
|
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 |
|
44 global multiplot_mode |
1541
|
45 global multiplot_xsize multiplot_ysize |
|
46 global multiplot_xn multiplot_yn |
|
47 global multiplot_xi multiplot_yi |
1540
|
48 |
2303
|
49 ## This is a real kludge. We gnuplot should be made so that replot can |
|
50 ## be executed while doing multiple plots... |
1540
|
51 |
|
52 global multiplot_save_auto_replot = automatic_replot |
|
53 |
|
54 if ((isstr (automatic_replot) && strcmp (automatic_replot,"true")) |
|
55 || automatic_replot) |
|
56 warning ("turning off automatic replot for multiplot mode"); |
|
57 multiplot_save_auto_replot = automatic_replot; |
|
58 automatic_replot = 0; |
|
59 endif |
|
60 |
|
61 set nologscale; |
|
62 set nopolar; |
|
63 |
2315
|
64 __plt__ ("plot", all_va_args); |
1540
|
65 |
2303
|
66 ## update the plot position |
1540
|
67 |
|
68 if (multiplot_mode) |
|
69 |
1541
|
70 if (multiplot_xi < multiplot_xn) |
|
71 multiplot_xi++; |
1540
|
72 else |
1541
|
73 multiplot_xi = 1; |
|
74 if (multiplot_yi < multiplot_xn) |
|
75 multiplot_yi++; |
1540
|
76 else |
1541
|
77 multiplot_yi = 1; |
1540
|
78 endif |
|
79 endif |
|
80 |
1541
|
81 xo = (multiplot_xi - 1.0)*multiplot_xsize; |
|
82 yo = (multiplot_yn - multiplot_yi)*multiplot_ysize; |
1540
|
83 |
|
84 eval (sprintf ("set origin %g, %g", xo,yo)); |
|
85 |
|
86 endif |
|
87 |
|
88 endfunction |
|
89 |
|
90 |
|
91 |