1## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
2## 2003, 2004, 2005, 2006, 2007, 2008 Shai Ayal
4## This file is part of Octave.
6## Octave is free software; you can redistribute it and/or modify it
7## under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 3 of the License, or (at
9## your option) any later version.
11## Octave is distributed in the hope that it will be useful, but
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.
16## You should have received a copy of the GNU General Public License
17## along with Octave; see the file COPYING. If not, see
18## <http://www.gnu.org/licenses/>.
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{})
27## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{})
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
30## arguments; see the latter for their interpretation. The set of
31## contour levels, @var{c}, is only returned if requested. For example:
38## contour (x, y, z, 2:3)
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.
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
49## @seealso{contourc, patch, plot}
52## Author: Shai Ayal <shaiay@users.sourceforge.net>
54function [c, h] = contour (varargin)
56 [xh, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
62 [ctmp, htmp] = __contour__ (xh, "none", varargin{:});
63 unwind_protect_cleanup
75%! [x, y, z] = peaks ();
79%! [theta, r] = meshgrid (linspace (0, 2*pi, 64), linspace(0,1,64));
80%! [X, Y] = pol2cart (theta, r);
81%! Z = sin(2*theta).*(1-r);
82%! contour(X, Y, abs(Z), 10)