annotate scripts/plot/__plt2__.m @ 9110:22ae6b3411a7

Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
author David Bateman <dbateman@free.fr>
date Sat, 11 Apr 2009 16:26:01 +0200
parents eb63fbe60fab
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8812
diff changeset
1 ## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2005, 2006, 2007,
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8812
diff changeset
2 ## 2008, 2009 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
3 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
4 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
5 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
7 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
9 ## your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
10 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
14 ## General Public License for more details.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
15 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2303
diff changeset
16 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
18 ## <http://www.gnu.org/licenses/>.
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
19
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 7664
diff changeset
20 ## -*- texinfo -*-
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 7664
diff changeset
21 ## @deftypefn {Function File} {} __plt2__ (@var{h}, @var{x1}, @var{x2}, @var{options}, @var{properties})
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6795
diff changeset
22 ## Undocumented internal function.
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 7664
diff changeset
23 ## @end deftypefn
3402
9610d364e444 [project @ 2000-01-05 04:36:38 by jwe]
jwe
parents: 2847
diff changeset
24
2314
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
25 ## Author: jwe
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
26
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
27 function retval = __plt2__ (h, x1, x2, options, properties)
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
28
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
29 if (nargin < 3 || nargin > 5)
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 5741
diff changeset
30 print_usage ();
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
31 endif
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
32
6264
cc2bee854d23 [project @ 2007-02-01 10:00:05 by jwe]
jwe
parents: 6257
diff changeset
33 if (nargin < 4 || isempty (options))
cc2bee854d23 [project @ 2007-02-01 10:00:05 by jwe]
jwe
parents: 6257
diff changeset
34 options = __default_plot_options__ ();
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
35 endif
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
36
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
37 if (nargin < 5)
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
38 properties = {};
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
39 endif
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
40
6264
cc2bee854d23 [project @ 2007-02-01 10:00:05 by jwe]
jwe
parents: 6257
diff changeset
41 if (! isstruct (options))
cc2bee854d23 [project @ 2007-02-01 10:00:05 by jwe]
jwe
parents: 6257
diff changeset
42 error ("__plt1__: options must be a struct array");
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
43 endif
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
44
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
45 if (any (any (imag (x1))))
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
46 x1 = real (x1);
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
47 endif
5115
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
48
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
49 if (any (any (imag (x2))))
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
50 x2 = real (x2);
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
51 endif
5115
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
52
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6264
diff changeset
53 h_set = false;
7664
0dff8d9bf229 Fix for plot(zeros(1,0),zeros(1,0))
David Bateman <dbateman@free.fr>
parents: 7290
diff changeset
54 if (isempty (x1) && isempty (x2))
0dff8d9bf229 Fix for plot(zeros(1,0),zeros(1,0))
David Bateman <dbateman@free.fr>
parents: 7290
diff changeset
55 retval = zeros (0, 1);
0dff8d9bf229 Fix for plot(zeros(1,0),zeros(1,0))
David Bateman <dbateman@free.fr>
parents: 7290
diff changeset
56 elseif (isscalar (x1))
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3449
diff changeset
57 if (isscalar (x2))
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
58 retval = __plt2ss__ (h, x1, x2, options, properties);
7290
7c0a18b10c8e [project @ 2007-12-11 18:02:06 by jwe]
jwe
parents: 7017
diff changeset
59 elseif (isvector (x2))
7c0a18b10c8e [project @ 2007-12-11 18:02:06 by jwe]
jwe
parents: 7017
diff changeset
60 retval = __plt2sv__ (h, x1, x2, options, properties);
5115
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
61 else
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
62 error ("__plt2__: invalid data for plotting");
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
63 endif
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3449
diff changeset
64 elseif (isvector (x1))
7290
7c0a18b10c8e [project @ 2007-12-11 18:02:06 by jwe]
jwe
parents: 7017
diff changeset
65 if (isscalar (x2))
7c0a18b10c8e [project @ 2007-12-11 18:02:06 by jwe]
jwe
parents: 7017
diff changeset
66 retval = __plt2vs__ (h, x1, x2, options, properties);
7c0a18b10c8e [project @ 2007-12-11 18:02:06 by jwe]
jwe
parents: 7017
diff changeset
67 elseif (isvector (x2))
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
68 retval = __plt2vv__ (h, x1, x2, options, properties);
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3449
diff changeset
69 elseif (ismatrix (x2))
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
70 retval = __plt2vm__ (h, x1, x2, options, properties);
5115
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
71 else
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
72 error ("__plt2__: invalid data for plotting");
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
73 endif
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3449
diff changeset
74 elseif (ismatrix (x1))
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3449
diff changeset
75 if (isvector (x2))
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
76 retval = __plt2mv__ (h, x1, x2, options, properties);
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3449
diff changeset
77 elseif (ismatrix (x2))
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6302
diff changeset
78 retval = __plt2mm__ (h, x1, x2, options, properties);
5115
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
79 else
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
80 error ("__plt2__: invalid data for plotting");
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
81 endif
5115
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
82 else
57372235194b [project @ 2005-01-24 18:38:45 by jwe]
jwe
parents: 4030
diff changeset
83 error ("__plt2__: invalid data for plotting");
933
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
84 endif
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
85
598a3aa40360 [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents:
diff changeset
86 endfunction