Mercurial > hg > octave-nkf
comparison scripts/plot/plot3.m @ 6302:a5cd8b77e892
[project @ 2007-02-13 08:08:33 by jwe]
author | jwe |
---|---|
date | Tue, 13 Feb 2007 08:10:51 +0000 |
parents | 0078497b3b0b |
children | 2110cc251779 |
comparison
equal
deleted
inserted
replaced
6301:2bab2360f07f | 6302:a5cd8b77e892 |
---|---|
91 ## @end deftypefn | 91 ## @end deftypefn |
92 | 92 |
93 ## Author: Paul Kienzle | 93 ## Author: Paul Kienzle |
94 ## (modified from __plt__.m) | 94 ## (modified from __plt__.m) |
95 | 95 |
96 function plot3 (varargin) | 96 function retval = plot3 (varargin) |
97 | 97 |
98 x_set = 0; | 98 x_set = 0; |
99 y_set = 0; | 99 y_set = 0; |
100 z_set = 0; | 100 z_set = 0; |
101 | |
102 idx = 0; | |
101 | 103 |
102 ## Gather arguments, decode format, and plot lines. | 104 ## Gather arguments, decode format, and plot lines. |
103 for arg = 1:nargin | 105 for arg = 1:nargin |
104 new = varargin{arg}; | 106 new = varargin{arg}; |
105 | 107 |
146 key = options.key; | 148 key = options.key; |
147 if (! isempty (key)) | 149 if (! isempty (key)) |
148 set (gca (), "key", "on"); | 150 set (gca (), "key", "on"); |
149 endif | 151 endif |
150 | 152 |
151 line (x(:), y(:), z(:), "keylabel", key, | 153 tmp(++idx) = line (x(:), y(:), z(:), "keylabel", key, |
152 "color", options.color, | 154 "color", options.color, |
153 "linestyle", options.linestyle, | 155 "linestyle", options.linestyle, |
154 "marker", options.marker); | 156 "marker", options.marker); |
155 | 157 |
156 x_set = 0; | 158 x_set = 0; |
157 y_set = 0; | 159 y_set = 0; |
158 z_set = 0; | 160 z_set = 0; |
159 elseif (! x_set) | 161 elseif (! x_set) |
180 | 182 |
181 if (! size_equal (x, y) || ! size_equal (x, z)) | 183 if (! size_equal (x, y) || ! size_equal (x, z)) |
182 error ("plot3: x, y, and z must have the same shape"); | 184 error ("plot3: x, y, and z must have the same shape"); |
183 endif | 185 endif |
184 | 186 |
185 line (x(:), y(:), z(:)); | 187 tmp(++idx) = line (x(:), y(:), z(:)); |
186 | 188 |
187 x = new; | 189 x = new; |
188 y_set = 0; | 190 y_set = 0; |
189 z_set = 0; | 191 z_set = 0; |
190 endif | 192 endif |
226 | 228 |
227 if (! size_equal (x, y) || ! size_equal (x, z)) | 229 if (! size_equal (x, y) || ! size_equal (x, z)) |
228 error ("plot3: x, y, and z must have the same shape"); | 230 error ("plot3: x, y, and z must have the same shape"); |
229 endif | 231 endif |
230 | 232 |
231 line (x(:), y(:), z(:)); | 233 tmp(++idx) = line (x(:), y(:), z(:)); |
232 | 234 |
233 endif | 235 endif |
234 | 236 |
235 set (gca (), "view", [-37.5, 30]); | 237 set (gca (), "view", [-37.5, 30]); |
236 | 238 |
239 if (nargout > 0 && idx > 0) | |
240 retval = tmp; | |
241 endif | |
242 | |
237 endfunction | 243 endfunction |