7017
|
1 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2004, |
|
2 ## 2005, 2006, 2007 John W. Eaton |
2313
|
3 ## |
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
|
7 ## under the terms of the GNU General Public License as published by |
7016
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
2313
|
10 ## |
|
11 ## Octave is distributed in the hope that it will be useful, but |
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
245
|
19 |
6895
|
20 ## Undocumented internal function. |
3402
|
21 |
2314
|
22 ## Author: jwe |
|
23 |
6302
|
24 function retval = __plt__ (caller, h, varargin) |
5406
|
25 |
6257
|
26 nargs = nargin - 2; |
6146
|
27 |
6257
|
28 if (nargs > 0) |
934
|
29 |
5116
|
30 k = 1; |
5119
|
31 |
|
32 x_set = false; |
|
33 y_set = false; |
6459
|
34 property_set = false; |
|
35 properties = {}; |
934
|
36 |
5116
|
37 ## Gather arguments, decode format, gather plot strings, and plot lines. |
934
|
38 |
6405
|
39 retval = []; |
|
40 |
6257
|
41 while (nargs > 0 || x_set) |
5115
|
42 |
5119
|
43 if (nargs == 0) |
|
44 ## Force the last plot when input variables run out. |
6459
|
45 next_cell = {}; |
6146
|
46 next_arg = {""}; |
5118
|
47 else |
6459
|
48 next_cell = varargin(k); |
5119
|
49 next_arg = varargin{k++}; |
5116
|
50 endif |
934
|
51 |
6257
|
52 nargs--; |
|
53 |
6146
|
54 if (ischar (next_arg) || iscellstr (next_arg)) |
5119
|
55 if (x_set) |
6459
|
56 [options, valid] = __pltopt__ (caller, next_arg, false); |
|
57 if (! valid) |
|
58 if (nargs == 0) |
|
59 error ("%s: properties must appear followed by a value", caller); |
|
60 endif |
|
61 properties = [properties, [next_cell, varargin(k++)]]; |
|
62 nargs--; |
|
63 continue; |
|
64 else |
|
65 while (nargs > 0 && ischar (varargin{k})) |
|
66 if (nargs < 2) |
|
67 error ("%s: properties must appear followed by a value", |
|
68 caller); |
|
69 endif |
|
70 properties = [properties, varargin(k:k+1)]; |
|
71 k += 2; |
|
72 nargs -= 2; |
|
73 endwhile |
|
74 endif |
5119
|
75 if (y_set) |
6459
|
76 tmp = __plt2__ (h, x, y, options, properties); |
|
77 properties = {}; |
6405
|
78 retval = [retval; tmp]; |
5119
|
79 else |
6459
|
80 tmp = __plt1__ (h, x, options, properties); |
|
81 properties = {}; |
6405
|
82 retval = [retval; tmp]; |
5741
|
83 endif |
5119
|
84 x_set = false; |
|
85 y_set = false; |
|
86 else |
5116
|
87 error ("plot: no data to plot"); |
|
88 endif |
|
89 elseif (x_set) |
|
90 if (y_set) |
6264
|
91 options = __pltopt__ (caller, {""}); |
6459
|
92 tmp = __plt2__ (h, x, y, options, properties); |
6405
|
93 retval = [retval; tmp]; |
5119
|
94 x = next_arg; |
|
95 y_set = false; |
6459
|
96 properties = {}; |
5116
|
97 else |
5119
|
98 y = next_arg; |
|
99 y_set = true; |
5116
|
100 endif |
|
101 else |
5119
|
102 x = next_arg; |
|
103 x_set = true; |
4
|
104 endif |
934
|
105 |
5118
|
106 endwhile |
934
|
107 |
4
|
108 else |
5119
|
109 msg = sprintf ("%s (y)\n", caller); |
|
110 msg = sprintf ("%s %s (x, y, ...)\n", msg, caller); |
|
111 msg = sprintf ("%s %s (x, y, fmt, ...)", msg, caller); |
6459
|
112 msg = sprintf ("%s %s (x, y, property, value, ...)", msg, caller); |
934
|
113 usage (msg); |
4
|
114 endif |
|
115 |
6004
|
116 endfunction |
6459
|
117 |