5837
|
1 ## Copyright (C) 1996 John W. Eaton |
|
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 |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
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 |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __plt3__ (@var{x}, @var{y}, @var{z}, @var{fmt}) |
|
22 ## @end deftypefn |
|
23 |
|
24 ## Author: Paul Kienzle <kienzle.powernet.co.uk> |
|
25 ## 2001-04-06 Paul Kienzle <kienzle.powernet.co.uk> |
|
26 ## * __gnuplot_set__ nohidden3d; vector X,Y, matrix Z => meshgrid(X,Y) |
|
27 |
|
28 ## Modified to use new gnuplot interface in octave > 2.9.0 |
|
29 ## Dmitri A. Sergatskov <dasergatskov@gmail.com> |
|
30 ## April 18, 2005 |
|
31 ## Modified to use NaN as seperator for gnuplot, so multiple calls |
|
32 ## aren't needed. |
|
33 ## David Bateman <dbateman@free.fr> |
|
34 ## May 25, 2006 |
|
35 |
|
36 function __plt3__ (x, y, z, fmt) |
|
37 |
5838
|
38 if (isvector (x) && isvector (y)) |
|
39 if (isvector (z)) |
|
40 x = x(:); |
|
41 y = y(:); |
|
42 z = z(:); |
|
43 elseif (length (x) == rows (z) && length (y) == columns (z)) |
|
44 error ("plot3: [length(x), length(y)] must match size(z)"); |
5837
|
45 else |
5838
|
46 [x, y] = meshgrid (x, y); |
5837
|
47 endif |
|
48 endif |
|
49 |
5838
|
50 if (any (size (x) != size (y)) || any (size (x) != size (z))) |
|
51 error ("plot3: x, y, and z must have the same shape"); |
5837
|
52 endif |
|
53 |
|
54 unwind_protect |
5838
|
55 __gnuplot_set__ parametric; |
5837
|
56 __gnuplot_raw__ ("set nohidden3d;\n"); |
|
57 |
|
58 tmp = [([x; NaN*ones(1,size(x,2))])(:), ... |
|
59 ([y; NaN*ones(1,size(y,2))])(:), ... |
|
60 ([z; NaN*ones(1,size(z,2))])(:)]; |
|
61 |
5838
|
62 eval (sprintf ("__gnuplot_splot__ tmp %s\n", fmt)); |
5837
|
63 unwind_protect_cleanup |
|
64 __gnuplot_set__ noparametric; |
|
65 end_unwind_protect |
|
66 endfunction |