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. |
245
|
19 |
3449
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __plt__ (@code{caller}, @dots{}) |
|
22 ## @end deftypefn |
3402
|
23 |
2314
|
24 ## Author: jwe |
|
25 |
6257
|
26 function __plt__ (caller, h, varargin) |
5406
|
27 |
6257
|
28 nargs = nargin - 2; |
6146
|
29 |
6257
|
30 if (nargs > 0) |
934
|
31 |
5116
|
32 k = 1; |
5119
|
33 |
|
34 x_set = false; |
|
35 y_set = false; |
934
|
36 |
5116
|
37 ## Gather arguments, decode format, gather plot strings, and plot lines. |
934
|
38 |
6257
|
39 while (nargs > 0 || x_set) |
5115
|
40 |
5119
|
41 if (nargs == 0) |
|
42 ## Force the last plot when input variables run out. |
6146
|
43 next_arg = {""}; |
5118
|
44 else |
5119
|
45 next_arg = varargin{k++}; |
5116
|
46 endif |
934
|
47 |
6257
|
48 nargs--; |
|
49 |
6146
|
50 if (ischar (next_arg) || iscellstr (next_arg)) |
5119
|
51 if (x_set) |
6257
|
52 [fmt, key] = __pltopt__ (caller, next_arg); |
5119
|
53 if (y_set) |
6257
|
54 __plt2__ (h, x, y, fmt, key); |
5119
|
55 else |
6257
|
56 __plt1__ (h, x, fmt, key); |
5741
|
57 endif |
5119
|
58 x_set = false; |
|
59 y_set = false; |
|
60 else |
5116
|
61 error ("plot: no data to plot"); |
|
62 endif |
|
63 elseif (x_set) |
|
64 if (y_set) |
6257
|
65 [fmt, key] = __pltopt__ (caller, {""}); |
|
66 __plt2__ (h, x, y, fmt, key); |
5119
|
67 x = next_arg; |
|
68 y_set = false; |
5116
|
69 else |
5119
|
70 y = next_arg; |
|
71 y_set = true; |
5116
|
72 endif |
|
73 else |
5119
|
74 x = next_arg; |
|
75 x_set = true; |
4
|
76 endif |
934
|
77 |
5118
|
78 endwhile |
934
|
79 |
6257
|
80 drawnow (); |
5118
|
81 |
4
|
82 else |
5119
|
83 msg = sprintf ("%s (y)\n", caller); |
|
84 msg = sprintf ("%s %s (x, y, ...)\n", msg, caller); |
|
85 msg = sprintf ("%s %s (x, y, fmt, ...)", msg, caller); |
934
|
86 usage (msg); |
4
|
87 endif |
|
88 |
6004
|
89 endfunction |