annotate scripts/plot/contour3.m @ 7216:5389a52df87b

[project @ 2007-11-29 19:07:29 by jwe]
author jwe
date Thu, 29 Nov 2007 19:07:29 +0000
parents dd88d61d443f
children d65670971cbc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 2007 David BAteman
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 -*-
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
20 ## @deftypefn {Function File} {@var{c} =} contour3 (@var{z})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefnx {Function File} {@var{c} =} contour3 (@var{z}, @var{vn})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
22 ## @deftypefnx {Function File} {@var{c} =} contour3 (@var{x}, @var{y}, @var{z})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
23 ## @deftypefnx {Function File} {@var{c} =} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
24 ## @deftypefnx {Function File} {@var{c} =} contour3 (@var{h}, @dots{})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
25 ## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
26 ## 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
27 ## 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
28 ## arguments; see the latter for their interpretation. The contours are
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
29 ## 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
30 ## 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
31 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
32 ## @example
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
33 ## @group
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
34 ## contour3 (peaks (19));
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
35 ## hold on
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
36 ## surface (peaks (19), 'FaceColor', 'none', 'EdgeColor', 'black')
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
37 ## colormap hot
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
38 ## @end group
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
39 ## @end example
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
40 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
41 ## 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
42 ## 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
43 ## returned.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
44 ## @seealso{contourc, patch, plot}
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
45 ## @end deftypefn
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
46
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
47 function [c, h] = contour3 (varargin)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
48
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
49 [xh, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
50
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
51 oldh = gca ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
52 unwind_protect
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
53 axes (xh);
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
54 newplot ();
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
55 [ctmp, htmp] = __contour__ (xh, "level", varargin{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
56 unwind_protect_cleanup
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
57 axes (oldh);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
58 end_unwind_protect
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
59
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
60 if (! ishold ())
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
61 set (xh, "view", [-37.5, 30]);
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
62 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
63
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
64 if (nargout > 0)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
65 c = ctmp;
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
66 h = htmp
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 endfunction