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 -*- |
7317
|
21 ## @deftypefn {Function File} {} contour (@var{z}) |
|
22 ## @deftypefnx {Function File} {} contour (@var{z}, @var{vn}) |
|
23 ## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}) |
|
24 ## @deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{vn}) |
|
25 ## @deftypefnx {Function File} {} contour (@dots{}, @var{style}) |
|
26 ## @deftypefnx {Function File} {} contour (@var{h}, @dots{}) |
7170
|
27 ## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{}) |
6604
|
28 ## Plot level curves (contour lines) of the matrix @var{z}, using the |
|
29 ## contour matrix @var{c} computed by @code{contourc} from the same |
6895
|
30 ## arguments; see the latter for their interpretation. The set of |
|
31 ## contour levels, @var{c}, is only returned if requested. For example: |
6257
|
32 ## |
|
33 ## @example |
6604
|
34 ## @group |
|
35 ## x = 0:2; |
|
36 ## y = x; |
|
37 ## z = x' * y; |
|
38 ## contour (x, y, z, 2:3) |
|
39 ## @end group |
6257
|
40 ## @end example |
7170
|
41 ## |
7317
|
42 ## The style to use for the plot can be defined with a line style @var{style} |
|
43 ## in a similar manner to the line styles used with the @code{plot} command. |
|
44 ## Any markers defined by @var{style} are ignored. |
|
45 ## |
7170
|
46 ## The optional input and output argument @var{h} allows an axis handle to |
|
47 ## be passed to @code{contour} and the handles to the contour objects to be |
|
48 ## returned. |
|
49 ## @seealso{contourc, patch, plot} |
3368
|
50 ## @end deftypefn |
4
|
51 |
6257
|
52 ## Author: shaia |
|
53 |
7170
|
54 function [c, h] = contour (varargin) |
6434
|
55 |
7216
|
56 [xh, varargin] = __plt_get_axis_arg__ ("contour", varargin{:}); |
|
57 |
7215
|
58 oldh = gca (); |
|
59 unwind_protect |
7216
|
60 axes (xh); |
7170
|
61 newplot (); |
7216
|
62 [ctmp, htmp] = __contour__ (xh, NaN, varargin{:}); |
7215
|
63 unwind_protect_cleanup |
|
64 axes (oldh); |
|
65 end_unwind_protect |
6257
|
66 |
|
67 if (nargout > 0) |
7170
|
68 c = ctmp; |
7189
|
69 h = htmp; |
4
|
70 endif |
|
71 |
|
72 endfunction |
7245
|
73 |
|
74 %!demo |
|
75 %! [x, y, z] = peaks (); |
|
76 %! contour (x, y, z); |