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 |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
2313
|
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 |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
245
|
18 |
6895
|
19 ## Undocumented internal function. |
3402
|
20 |
2314
|
21 ## Author: jwe |
|
22 |
6302
|
23 function retval = __plt__ (caller, h, varargin) |
5406
|
24 |
6257
|
25 nargs = nargin - 2; |
6146
|
26 |
6257
|
27 if (nargs > 0) |
934
|
28 |
5116
|
29 k = 1; |
5119
|
30 |
|
31 x_set = false; |
|
32 y_set = false; |
6459
|
33 property_set = false; |
|
34 properties = {}; |
934
|
35 |
5116
|
36 ## Gather arguments, decode format, gather plot strings, and plot lines. |
934
|
37 |
6405
|
38 retval = []; |
|
39 |
6257
|
40 while (nargs > 0 || x_set) |
5115
|
41 |
5119
|
42 if (nargs == 0) |
|
43 ## Force the last plot when input variables run out. |
6459
|
44 next_cell = {}; |
6146
|
45 next_arg = {""}; |
5118
|
46 else |
6459
|
47 next_cell = varargin(k); |
5119
|
48 next_arg = varargin{k++}; |
5116
|
49 endif |
934
|
50 |
6257
|
51 nargs--; |
|
52 |
6146
|
53 if (ischar (next_arg) || iscellstr (next_arg)) |
5119
|
54 if (x_set) |
6459
|
55 [options, valid] = __pltopt__ (caller, next_arg, false); |
|
56 if (! valid) |
|
57 if (nargs == 0) |
|
58 error ("%s: properties must appear followed by a value", caller); |
|
59 endif |
|
60 properties = [properties, [next_cell, varargin(k++)]]; |
|
61 nargs--; |
|
62 continue; |
|
63 else |
|
64 while (nargs > 0 && ischar (varargin{k})) |
|
65 if (nargs < 2) |
|
66 error ("%s: properties must appear followed by a value", |
|
67 caller); |
|
68 endif |
|
69 properties = [properties, varargin(k:k+1)]; |
|
70 k += 2; |
|
71 nargs -= 2; |
|
72 endwhile |
|
73 endif |
5119
|
74 if (y_set) |
6459
|
75 tmp = __plt2__ (h, x, y, options, properties); |
|
76 properties = {}; |
6405
|
77 retval = [retval; tmp]; |
5119
|
78 else |
6459
|
79 tmp = __plt1__ (h, x, options, properties); |
|
80 properties = {}; |
6405
|
81 retval = [retval; tmp]; |
5741
|
82 endif |
5119
|
83 x_set = false; |
|
84 y_set = false; |
|
85 else |
5116
|
86 error ("plot: no data to plot"); |
|
87 endif |
|
88 elseif (x_set) |
|
89 if (y_set) |
6264
|
90 options = __pltopt__ (caller, {""}); |
6459
|
91 tmp = __plt2__ (h, x, y, options, properties); |
6405
|
92 retval = [retval; tmp]; |
5119
|
93 x = next_arg; |
|
94 y_set = false; |
6459
|
95 properties = {}; |
5116
|
96 else |
5119
|
97 y = next_arg; |
|
98 y_set = true; |
5116
|
99 endif |
|
100 else |
5119
|
101 x = next_arg; |
|
102 x_set = true; |
4
|
103 endif |
934
|
104 |
5118
|
105 endwhile |
934
|
106 |
4
|
107 else |
5119
|
108 msg = sprintf ("%s (y)\n", caller); |
|
109 msg = sprintf ("%s %s (x, y, ...)\n", msg, caller); |
|
110 msg = sprintf ("%s %s (x, y, fmt, ...)", msg, caller); |
6459
|
111 msg = sprintf ("%s %s (x, y, property, value, ...)", msg, caller); |
934
|
112 usage (msg); |
4
|
113 endif |
|
114 |
6004
|
115 endfunction |
6459
|
116 |