7017
|
1 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, |
|
2 ## 2003, 2004, 2005, 2006, 2007 Shai Ayal |
2313
|
3 ## |
6440
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
2313
|
7 ## under the terms of the GNU General Public License as published by |
7016
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
2313
|
10 ## |
6440
|
11 ## Octave is distributed in the hope that it will be useful, but |
2313
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
245
|
19 |
3368
|
20 ## -*- texinfo -*- |
6888
|
21 ## @deftypefn {Function File} {@var{c} =} contour (@var{z}) |
|
22 ## @deftypefnx {Function File} {@var{c} =} contour (@var{z}, @var{vn}) |
|
23 ## @deftypefnx {Function File} {@var{c} =} contour (@var{x}, @var{y}, @var{z}) |
|
24 ## @deftypefnx {Function File} {@var{c} =} contour (@var{x}, @var{y}, @var{z}, @var{vn}) |
7170
|
25 ## @deftypefnx {Function File} {@var{c} =} contour (@var{h}, @dots{}) |
|
26 ## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{}) |
6604
|
27 ## Plot level curves (contour lines) of the matrix @var{z}, using the |
|
28 ## contour matrix @var{c} computed by @code{contourc} from the same |
6895
|
29 ## arguments; see the latter for their interpretation. The set of |
|
30 ## contour levels, @var{c}, is only returned if requested. For example: |
6257
|
31 ## |
|
32 ## @example |
6604
|
33 ## @group |
|
34 ## x = 0:2; |
|
35 ## y = x; |
|
36 ## z = x' * y; |
|
37 ## contour (x, y, z, 2:3) |
|
38 ## @end group |
6257
|
39 ## @end example |
7170
|
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} |
3368
|
45 ## @end deftypefn |
4
|
46 |
6257
|
47 ## Author: shaia |
|
48 |
7170
|
49 function [c, h] = contour (varargin) |
6434
|
50 |
7216
|
51 [xh, varargin] = __plt_get_axis_arg__ ("contour", varargin{:}); |
|
52 |
7215
|
53 oldh = gca (); |
|
54 unwind_protect |
7216
|
55 axes (xh); |
7170
|
56 newplot (); |
7216
|
57 [ctmp, htmp] = __contour__ (xh, NaN, varargin{:}); |
7215
|
58 unwind_protect_cleanup |
|
59 axes (oldh); |
|
60 end_unwind_protect |
6257
|
61 |
|
62 if (nargout > 0) |
7170
|
63 c = ctmp; |
7189
|
64 h = htmp; |
4
|
65 endif |
|
66 |
|
67 endfunction |
7245
|
68 |
|
69 %!demo |
|
70 %! [x, y, z] = peaks (); |
|
71 %! contour (x, y, z); |