annotate scripts/plot/contour3.m @ 8920:eb63fbe60fab

update copyright notices
author John W. Eaton <jwe@octave.org>
date Sat, 07 Mar 2009 10:41:27 -0500
parents cadc73247d65
children dbd0c77e575e
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: 8507
diff changeset
1 ## Copyright (C) 2007, 2008, 2009 David BAteman
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
2 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
4 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
9 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
14 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
18
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
7317
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
20 ## @deftypefn {Function File} {} contour3 (@var{z})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
21 ## @deftypefnx {Function File} {} contour3 (@var{z}, @var{vn})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
22 ## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
23 ## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
24 ## @deftypefnx {Function File} {} contour3 (@dots{}, @var{style})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
25 ## @deftypefnx {Function File} {} contour3 (@var{h}, @dots{})
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
26 ## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
27 ## Plot level curves (contour lines) of the matrix @var{z}, using the
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
28 ## contour matrix @var{c} computed by @code{contourc} from the same
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
29 ## arguments; see the latter for their interpretation. The contours are
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
30 ## ploted at the Z level corresponding to their contour. The set of
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
31 ## contour levels, @var{c}, is only returned if requested. For example:
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
32 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
33 ## @example
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
34 ## @group
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
35 ## contour3 (peaks (19));
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
36 ## hold on
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8289
diff changeset
37 ## surface (peaks (19), "facecolor", "none", "EdgeColor", "black")
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
38 ## colormap hot
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
39 ## @end group
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
40 ## @end example
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
41 ##
7317
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
42 ## The style to use for the plot can be defined with a line style @var{style}
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
43 ## in a similar manner to the line styles used with the @code{plot} command.
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
44 ## Any markers defined by @var{style} are ignored.
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
45 ##
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
46 ## The optional input and output argument @var{h} allows an axis handle to
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
47 ## be passed to @code{contour} and the handles to the contour objects to be
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
48 ## returned.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
49 ## @seealso{contourc, patch, plot}
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
50 ## @end deftypefn
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
51
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
52 function [c, h] = contour3 (varargin)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
53
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
54 [xh, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
55
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
56 oldh = gca ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
57 unwind_protect
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
58 axes (xh);
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
59 newplot ();
8289
ac7f334d9652 Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents: 7317
diff changeset
60 [ctmp, htmp] = __contour__ (xh, "auto", varargin{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
61 unwind_protect_cleanup
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
62 axes (oldh);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
63 end_unwind_protect
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
64
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
65 if (! ishold ())
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
66 set (xh, "view", [-37.5, 30]);
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
67 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
68
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
69 if (nargout > 0)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
70 c = ctmp;
8289
ac7f334d9652 Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents: 7317
diff changeset
71 h = htmp;
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
72 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
73
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
74 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
75
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
76 %!demo
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
77 %! contour3 (peaks (19));
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
78 %! hold on
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8289
diff changeset
79 %! surface (peaks (19), "facecolor", "none", "edgecolor", "black")
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
80 %! colormap hot
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
81 %! hold off