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) |
6257
|
38 ## |
6604
|
39 ## @end group |
6257
|
40 ## @end example |
7170
|
41 ## |
|
42 ## The optional input and output argument @var{h} allows an axis handle to |
|
43 ## be passed to @code{contour} and the handles to the contour objects to be |
|
44 ## returned. |
|
45 ## @seealso{contourc, patch, plot} |
3368
|
46 ## @end deftypefn |
4
|
47 |
6257
|
48 ## Author: shaia |
|
49 |
7170
|
50 function [c, h] = contour (varargin) |
6434
|
51 |
7170
|
52 if (isscalar (varargin{1}) && ishandle (varargin{1})) |
|
53 h = varargin{1}; |
|
54 if (! strcmp (get (h, "type"), "axes")) |
|
55 error ("contour: expecting first argument to be an axes object"); |
|
56 endif |
|
57 oldh = gca (); |
|
58 unwind_protect |
|
59 axes (h); |
|
60 newplot (); |
|
61 [ctmp, htmp] = __contour__ (h, varargin{2:end}); |
|
62 unwind_protect_cleanup |
|
63 axes (oldh); |
|
64 end_unwind_protect |
|
65 else |
|
66 newplot (); |
|
67 [ctmp, htmp] = __contour__ (gca (), NaN, varargin{:}); |
|
68 endif |
6257
|
69 |
|
70 if (nargout > 0) |
7170
|
71 c = ctmp; |
7189
|
72 h = htmp; |
4
|
73 endif |
|
74 |
|
75 endfunction |