annotate scripts/plot/mplot.m @ 6178:830235f4984f

[project @ 2006-11-17 00:16:57 by jwe]
author jwe
date Fri, 17 Nov 2006 00:19:18 +0000
parents 8614649c454c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2847
8b262e771614 [project @ 1997-03-27 16:18:26 by jwe]
jwe
parents: 2520
diff changeset
1 ## Copyright (C) 1996, 1997 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
2 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
3 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
4 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
6 ## under the terms of the GNU General Public License as published by
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
7 ## the Free Software Foundation; either version 2, or (at your option)
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
8 ## any later version.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
9 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
13 ## General Public License for more details.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
15 ## You should have received a copy of the GNU General Public License
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
5307
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5252
diff changeset
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5252
diff changeset
18 ## 02110-1301, USA.
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
19
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
20 ## -*- texinfo -*-
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
21 ## @deftypefn {Function File} {} mplot (@var{x}, @var{y})
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
22 ## @deftypefnx {Function File} {} mplot (@var{x}, @var{y}, @var{fmt})
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
23 ## @deftypefnx {Function File} {} mplot (@var{x1}, @var{y1}, @var{x2}, @var{y2})
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
24 ## This is a modified version of the @code{plot} function that works with
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3368
diff changeset
25 ## the multiplot version of @code{gnuplot} to plot multiple plots per page.
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
26 ## This plot version automatically advances to the next subplot position
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
27 ## after each set of arguments are processed.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3368
diff changeset
28 ##
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
29 ## See the description of the @var{plot} function for the various options.
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3162
diff changeset
30 ## @end deftypefn
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
31
2312
204cc7db6f4a [project @ 1996-07-11 21:20:36 by jwe]
jwe
parents: 2311
diff changeset
32 ## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU>
204cc7db6f4a [project @ 1996-07-11 21:20:36 by jwe]
jwe
parents: 2311
diff changeset
33 ## Adapted-By: jwe
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
34
3979
e0b7a493e5a8 [project @ 2002-07-10 17:45:34 by jwe]
jwe
parents: 3426
diff changeset
35 function mplot (varargin)
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
36
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
37 __plot_globals__;
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
38
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
39 cf = __current_figure__;
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
40
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
41 __gnuplot_raw__ ("set nologscale;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
42 __gnuplot_raw__ ("set nopolar;\n");
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
43
3979
e0b7a493e5a8 [project @ 2002-07-10 17:45:34 by jwe]
jwe
parents: 3426
diff changeset
44 __plt__ ("plot", varargin{:});
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
45
2303
5cffc4b8de57 [project @ 1996-06-24 09:15:24 by jwe]
jwe
parents: 2296
diff changeset
46 ## update the plot position
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
47
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
48 if (__multiplot_mode__(cf))
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
49
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
50 if (__multiplot_xi__(cf) < __multiplot_xn__(cf))
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
51 __multiplot_xi__(cf)++;
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
52 else
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
53 __multiplot_xi__(cf) = 1;
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
54 if (__multiplot_yi__(cf) < __multiplot_yn__(cf))
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
55 __multiplot_yi__(cf)++;
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
56 else
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
57 __multiplot_yi__(cf) = 1;
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
58 endif
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
59 endif
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
60
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
61 xo = (__multiplot_xi__(cf) - 1.0) * __multiplot_xsize__(cf);
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 5307
diff changeset
62 yo = (__multiplot_yn__(cf) - __multiplot_yi__(cf)) * __multiplot_ysize__(cf);
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
63
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
64 __gnuplot_raw__ (sprintf ("set origin %g, %g;\n", xo, yo));
1540
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
65
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
66 endif
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
67
749b8b19733f [project @ 1995-10-06 03:10:34 by jwe]
jwe
parents:
diff changeset
68 endfunction