Mercurial > hg > octave-lyh
comparison scripts/plot/plot3.m @ 6146:1a6d826e92b5
[project @ 2006-11-09 03:13:11 by jwe]
author | jwe |
---|---|
date | Thu, 09 Nov 2006 03:15:23 +0000 |
parents | 34b1758d3247 |
children | 045038e0108a |
comparison
equal
deleted
inserted
replaced
6145:14906c2745e3 | 6146:1a6d826e92b5 |
---|---|
57 ## or PNG, use the @code{print} command. | 57 ## or PNG, use the @code{print} command. |
58 ## | 58 ## |
59 ## An optional format argument can be given as | 59 ## An optional format argument can be given as |
60 ## | 60 ## |
61 ## @example | 61 ## @example |
62 ## plot3 (@var{x}, @var{y}, @var{y}, @var{fmt}) | 62 ## plot3 (@var{x}, @var{y}, @var{z}, @var{fmt}) |
63 ## @end example | 63 ## @end example |
64 ## | 64 ## |
65 ## If the @var{fmt} argument is supplied, it is interpreted as | 65 ## If the @var{fmt} argument is supplied, it is interpreted as |
66 ## follows. If @var{fmt} is missing, the default gnuplot line style | 66 ## follows. If @var{fmt} is missing, the default gnuplot line style |
67 ## is assumed. | 67 ## is assumed. |
130 ## it is left out. | 130 ## it is left out. |
131 ## | 131 ## |
132 ## Arguments can also be given in groups of three as | 132 ## Arguments can also be given in groups of three as |
133 ## | 133 ## |
134 ## @example | 134 ## @example |
135 ## plot3 (@var{x1}, @var{y1}, @var{y1}, @var{x2}, @var{y2}, @var{y2}, @dots{}) | 135 ## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{}) |
136 ## @end example | 136 ## @end example |
137 ## | 137 ## |
138 ## @noindent | 138 ## @noindent |
139 ## where each set of three arguments is treated as a seperate line or | 139 ## where each set of three arguments is treated as a seperate line or |
140 ## set of lines in three dimensions. | 140 ## set of lines in three dimensions. |
197 z = imag (y); | 197 z = imag (y); |
198 y = real (y); | 198 y = real (y); |
199 z_set = 1; | 199 z_set = 1; |
200 endif | 200 endif |
201 endif | 201 endif |
202 fmt = __pltopt__ ("plot3", new); | 202 [fmt, key] = __pltopt__ ("plot3", new); |
203 | 203 |
204 if (isvector (x) && isvector (y)) | 204 if (isvector (x) && isvector (y)) |
205 if (isvector (z)) | 205 if (isvector (z)) |
206 x = x(:); | 206 x = x(:); |
207 y = y(:); | 207 y = y(:); |
215 | 215 |
216 if (any (size (x) != size (y)) || any (size (x) != size (z))) | 216 if (any (size (x) != size (y)) || any (size (x) != size (z))) |
217 error ("plot3: x, y, and z must have the same shape"); | 217 error ("plot3: x, y, and z must have the same shape"); |
218 endif | 218 endif |
219 | 219 |
220 unwind_protect | 220 __gnuplot_raw__ ("set nohidden3d;\n") |
221 __gnuplot_raw__ ("set nohidden3d;\n") | 221 __gnuplot_set__ parametric; |
222 __gnuplot_set__ parametric; | 222 |
223 | 223 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ... |
224 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ... | 224 ([y; NaN*ones(1,size(y,2))])(:), ... |
225 ([y; NaN*ones(1,size(y,2))])(:), ... | 225 ([z; NaN*ones(1,size(z,2))])(:)], |
226 ([z; NaN*ones(1,size(z,2))])(:)], | 226 "u($1):($2):($3)", fmt{1}, key{1}); |
227 "u($1):($2):($3)", fmt); | |
228 | |
229 unwind_protect_cleanup | |
230 __gnuplot_set__ noparametric; | |
231 end_unwind_protect | |
232 | 227 |
233 hold ("on"); | 228 hold ("on"); |
234 x_set = 0; | 229 x_set = 0; |
235 y_set = 0; | 230 y_set = 0; |
236 z_set = 0; | 231 z_set = 0; |
258 | 253 |
259 if (any (size (x) != size (y)) || any (size (x) != size (z))) | 254 if (any (size (x) != size (y)) || any (size (x) != size (z))) |
260 error ("plot3: x, y, and z must have the same shape"); | 255 error ("plot3: x, y, and z must have the same shape"); |
261 endif | 256 endif |
262 | 257 |
263 unwind_protect | 258 __gnuplot_raw__ ("set nohidden3d;\n") |
264 __gnuplot_raw__ ("set nohidden3d;\n") | 259 __gnuplot_set__ parametric; |
265 __gnuplot_set__ parametric; | 260 |
266 | 261 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ... |
267 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ... | 262 ([y; NaN*ones(1,size(y,2))])(:), ... |
268 ([y; NaN*ones(1,size(y,2))])(:), ... | 263 ([z; NaN*ones(1,size(z,2))])(:)]); |
269 ([z; NaN*ones(1,size(z,2))])(:)]); | |
270 | |
271 unwind_protect_cleanup | |
272 __gnuplot_set__ noparametric; | |
273 end_unwind_protect | |
274 | 264 |
275 hold ("on"); | 265 hold ("on"); |
276 x = new; | 266 x = new; |
277 y_set = 0; | 267 y_set = 0; |
278 z_set = 0; | 268 z_set = 0; |
315 | 305 |
316 if (any (size (x) != size (y)) || any (size (x) != size (z))) | 306 if (any (size (x) != size (y)) || any (size (x) != size (z))) |
317 error ("plot3: x, y, and z must have the same shape"); | 307 error ("plot3: x, y, and z must have the same shape"); |
318 endif | 308 endif |
319 | 309 |
320 unwind_protect | 310 __gnuplot_raw__ ("set nohidden3d;\n") |
321 __gnuplot_raw__ ("set nohidden3d;\n") | 311 __gnuplot_set__ parametric; |
322 __gnuplot_set__ parametric; | 312 |
323 | 313 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ... |
324 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ... | 314 ([y; NaN*ones(1,size(y,2))])(:), ... |
325 ([y; NaN*ones(1,size(y,2))])(:), ... | 315 ([z; NaN*ones(1,size(z,2))])(:)]); |
326 ([z; NaN*ones(1,size(z,2))])(:)]); | |
327 unwind_protect_cleanup | |
328 __gnuplot_set__ noparametric; | |
329 end_unwind_protect | |
330 endif | 316 endif |
331 | 317 |
332 unwind_protect_cleanup | 318 unwind_protect_cleanup |
333 | 319 |
334 if (! hold_state) | 320 if (! hold_state) |