7175
|
1 ## Copyright (C) 2007 David BAteman |
|
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 3 of the License, or (at |
|
8 ## your option) 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, see |
|
17 ## <http://www.gnu.org/licenses/>. |
|
18 |
|
19 ## -*- texinfo -*- |
|
20 ## @deftypefn {Function File} {@var{c} =} contour3 (@var{z}) |
|
21 ## @deftypefnx {Function File} {@var{c} =} contour3 (@var{z}, @var{vn}) |
|
22 ## @deftypefnx {Function File} {@var{c} =} contour3 (@var{x}, @var{y}, @var{z}) |
|
23 ## @deftypefnx {Function File} {@var{c} =} contour3 (@var{x}, @var{y}, @var{z}, @var{vn}) |
|
24 ## @deftypefnx {Function File} {@var{c} =} contour3 (@var{h}, @dots{}) |
|
25 ## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{}) |
|
26 ## Plot level curves (contour lines) of the matrix @var{z}, using the |
|
27 ## contour matrix @var{c} computed by @code{contourc} from the same |
|
28 ## arguments; see the latter for their interpretation. The contours are |
|
29 ## ploted at the Z level corresponding to their contour. The set of |
|
30 ## contour levels, @var{c}, is only returned if requested. For example: |
|
31 ## |
|
32 ## @example |
|
33 ## @group |
|
34 ## contour3 (peaks (19)); |
|
35 ## hold on |
|
36 ## surface (peaks (19), 'FaceColor', 'none', 'EdgeColor', 'black') |
|
37 ## colormap hot |
|
38 ## @end group |
|
39 ## @end example |
|
40 ## |
|
41 ## The optional input and output argument @var{h} allows an axis handle to |
|
42 ## be passed to @code{contour} and the handles to the contour objects to be |
|
43 ## returned. |
|
44 ## @seealso{contourc, patch, plot} |
|
45 ## @end deftypefn |
|
46 |
|
47 function [c, h] = contour3 (varargin) |
|
48 |
7216
|
49 [xh, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:}); |
|
50 |
7215
|
51 oldh = gca (); |
|
52 unwind_protect |
7216
|
53 axes (xh); |
7175
|
54 newplot (); |
7216
|
55 [ctmp, htmp] = __contour__ (xh, "level", varargin{:}); |
7215
|
56 unwind_protect_cleanup |
|
57 axes (oldh); |
|
58 end_unwind_protect |
7175
|
59 |
|
60 if (! ishold ()) |
7216
|
61 set (xh, "view", [-37.5, 30]); |
7175
|
62 endif |
|
63 |
|
64 if (nargout > 0) |
|
65 c = ctmp; |
|
66 h = htmp |
|
67 endif |
|
68 |
|
69 endfunction |
7245
|
70 |
|
71 %!demo |
|
72 %! contour3 (peaks (19)); |
|
73 %! hold on |
|
74 %! surface (peaks (19), 'FaceColor', 'none', 'EdgeColor', 'black') |
|
75 %! colormap hot |
|
76 %! hold off |