annotate scripts/plot/contour3.m @ 14237:11949c9795a0

Revamp %!demos in m-files to use Octave coding conventions on spacing, etc. Add clf() to all demos using plot features to get reproducibility. Use 64 as input to all colormaps (jet (64)) to get reproducibility. * bicubic.m, cell2mat.m, celldisp.m, cplxpair.m, interp1.m, interp2.m, interpft.m, interpn.m, profile.m, profshow.m, convhull.m, delaunay.m, griddata.m, inpolygon.m, voronoi.m, autumn.m, bone.m, contrast.m, cool.m, copper.m, flag.m, gmap40.m, gray.m, hot.m, hsv.m, image.m, imshow.m, jet.m, ocean.m, pink.m, prism.m, rainbow.m, spring.m, summer.m, white.m, winter.m, condest.m, onenormest.m, axis.m, clabel.m, colorbar.m, comet.m, comet3.m, compass.m, contour.m, contour3.m, contourf.m, cylinder.m, daspect.m, ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, fplot.m, grid.m, hold.m, isosurface.m, legend.m, loglog.m, loglogerr.m, pareto.m, patch.m, pbaspect.m, pcolor.m, pie.m, pie3.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, rose.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, shading.m, slice.m, sombrero.m, stairs.m, stem.m, stem3.m, subplot.m, surf.m, surfc.m, surfl.m, surfnorm.m, text.m, title.m, trimesh.m, triplot.m, trisurf.m, uigetdir.m, uigetfile.m, uimenu.m, uiputfile.m, waitbar.m, xlim.m, ylim.m, zlim.m, mkpp.m, pchip.m, polyaffine.m, spline.m, bicgstab.m, cgs.m, gplot.m, pcg.m, pcr.m, treeplot.m, strtok.m, demo.m, example.m, rundemos.m, speed.m, test.m, calendar.m, datestr.m, datetick.m, weekday.m: Revamp %!demos to use Octave coding conventions on spacing, etc.
author Rik <octave@nomad.inbox5.com>
date Fri, 20 Jan 2012 12:59:53 -0800
parents 72c96de7a403
children 4506eade9f04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 14092
diff changeset
1 ## Copyright (C) 2007-2012 David BAteman
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
2 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
4 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
9 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
14 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
18
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 9040
diff changeset
20 ## @deftypefn {Function File} {} contour3 (@var{z})
7317
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
21 ## @deftypefnx {Function File} {} contour3 (@var{z}, @var{vn})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
22 ## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
23 ## @deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
24 ## @deftypefnx {Function File} {} contour3 (@dots{}, @var{style})
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
25 ## @deftypefnx {Function File} {} contour3 (@var{h}, @dots{})
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
26 ## @deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
27 ## Plot level curves (contour lines) of the matrix @var{z}, using the
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
28 ## contour matrix @var{c} computed by @code{contourc} from the same
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
29 ## arguments; see the latter for their interpretation. The contours are
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
30 ## plotted at the Z level corresponding to their contour. The set of
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
31 ## contour levels, @var{c}, is only returned if requested. For example:
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
32 ##
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
33 ## @example
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
34 ## @group
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
35 ## contour3 (peaks (19));
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
36 ## hold on
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8289
diff changeset
37 ## surface (peaks (19), "facecolor", "none", "EdgeColor", "black")
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
38 ## colormap hot
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
39 ## @end group
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
40 ## @end example
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
41 ##
7317
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
42 ## The style to use for the plot can be defined with a line style @var{style}
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
43 ## in a similar manner to the line styles used with the @code{plot} command.
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
44 ## Any markers defined by @var{style} are ignored.
11c5f1ee553e [project @ 2007-12-14 17:42:55 by jwe]
jwe
parents: 7245
diff changeset
45 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
46 ## The optional input and output argument @var{h} allows an axis handle to
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
47 ## be passed to @code{contour} and the handles to the contour objects to be
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
48 ## returned.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
49 ## @seealso{contourc, patch, plot}
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
50 ## @end deftypefn
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
51
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
52 function [c, h] = contour3 (varargin)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
53
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
54 [xh, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
55
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
56 oldh = gca ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
57 unwind_protect
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
58 axes (xh);
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
59 newplot ();
8289
ac7f334d9652 Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents: 7317
diff changeset
60 [ctmp, htmp] = __contour__ (xh, "auto", varargin{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
61 unwind_protect_cleanup
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
62 axes (oldh);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
63 end_unwind_protect
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
64
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
65 if (! ishold ())
11427
dc983f92e774 contour3.m: Grid on be default for 3D plots.
Ben Abbott <bpabbott@mac.com>
parents: 11307
diff changeset
66 set (xh, "view", [-37.5, 30],
dc983f92e774 contour3.m: Grid on be default for 3D plots.
Ben Abbott <bpabbott@mac.com>
parents: 11307
diff changeset
67 "xgrid", "on", "ygrid", "on", "zgrid", "on");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
68 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
69
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
70 if (nargout > 0)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
71 c = ctmp;
8289
ac7f334d9652 Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents: 7317
diff changeset
72 h = htmp;
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
73 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
74
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
75 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
76
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
77
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
78 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
79 %! clf;
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
80 %! contour3 (peaks (19));
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
81 %! hold on;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
82 %! surface (peaks (19), "facecolor", "none", "edgecolor", "black");
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
83 %! colormap (hot (64));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
84 %! axis tight;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
85 %! zlim auto;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
86 %! box off;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
87 %! hold off;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
88