comparison scripts/plot/__plt__.m @ 6459:5dc550e1f419

[project @ 2007-03-26 18:11:58 by jwe]
author jwe
date Mon, 26 Mar 2007 18:11:58 +0000
parents b298a4c12fc3
children 76e3d985ae56
comparison
equal deleted inserted replaced
6458:6588b4fe0869 6459:5dc550e1f419
31 31
32 k = 1; 32 k = 1;
33 33
34 x_set = false; 34 x_set = false;
35 y_set = false; 35 y_set = false;
36 property_set = false;
37 properties = {};
36 38
37 ## Gather arguments, decode format, gather plot strings, and plot lines. 39 ## Gather arguments, decode format, gather plot strings, and plot lines.
38 40
39 retval = []; 41 retval = [];
40 42
41 while (nargs > 0 || x_set) 43 while (nargs > 0 || x_set)
42 44
43 if (nargs == 0) 45 if (nargs == 0)
44 ## Force the last plot when input variables run out. 46 ## Force the last plot when input variables run out.
47 next_cell = {};
45 next_arg = {""}; 48 next_arg = {""};
46 else 49 else
50 next_cell = varargin(k);
47 next_arg = varargin{k++}; 51 next_arg = varargin{k++};
48 endif 52 endif
49 53
50 nargs--; 54 nargs--;
51 55
52 if (ischar (next_arg) || iscellstr (next_arg)) 56 if (ischar (next_arg) || iscellstr (next_arg))
53 if (x_set) 57 if (x_set)
54 options = __pltopt__ (caller, next_arg); 58 [options, valid] = __pltopt__ (caller, next_arg, false);
59 if (! valid)
60 if (nargs == 0)
61 error ("%s: properties must appear followed by a value", caller);
62 endif
63 properties = [properties, [next_cell, varargin(k++)]];
64 nargs--;
65 continue;
66 else
67 while (nargs > 0 && ischar (varargin{k}))
68 if (nargs < 2)
69 error ("%s: properties must appear followed by a value",
70 caller);
71 endif
72 properties = [properties, varargin(k:k+1)];
73 k += 2;
74 nargs -= 2;
75 endwhile
76 endif
55 if (y_set) 77 if (y_set)
56 tmp = __plt2__ (h, x, y, options); 78 tmp = __plt2__ (h, x, y, options, properties);
79 properties = {};
57 retval = [retval; tmp]; 80 retval = [retval; tmp];
58 else 81 else
59 tmp = __plt1__ (h, x, options); 82 tmp = __plt1__ (h, x, options, properties);
83 properties = {};
60 retval = [retval; tmp]; 84 retval = [retval; tmp];
61 endif 85 endif
62 x_set = false; 86 x_set = false;
63 y_set = false; 87 y_set = false;
64 else 88 else
65 error ("plot: no data to plot"); 89 error ("plot: no data to plot");
66 endif 90 endif
67 elseif (x_set) 91 elseif (x_set)
68 if (y_set) 92 if (y_set)
69 options = __pltopt__ (caller, {""}); 93 options = __pltopt__ (caller, {""});
70 tmp = __plt2__ (h, x, y, options); 94 tmp = __plt2__ (h, x, y, options, properties);
71 retval = [retval; tmp]; 95 retval = [retval; tmp];
72 x = next_arg; 96 x = next_arg;
73 y_set = false; 97 y_set = false;
98 properties = {};
74 else 99 else
75 y = next_arg; 100 y = next_arg;
76 y_set = true; 101 y_set = true;
77 endif 102 endif
78 else 103 else
84 109
85 else 110 else
86 msg = sprintf ("%s (y)\n", caller); 111 msg = sprintf ("%s (y)\n", caller);
87 msg = sprintf ("%s %s (x, y, ...)\n", msg, caller); 112 msg = sprintf ("%s %s (x, y, ...)\n", msg, caller);
88 msg = sprintf ("%s %s (x, y, fmt, ...)", msg, caller); 113 msg = sprintf ("%s %s (x, y, fmt, ...)", msg, caller);
114 msg = sprintf ("%s %s (x, y, property, value, ...)", msg, caller);
89 usage (msg); 115 usage (msg);
90 endif 116 endif
91 117
92 endfunction 118 endfunction
119