annotate scripts/plot/contour3.m @ 17129:b5d6314314fc

Change various plot functions to take advantage of new isaxes() function. * scripts/geometry/voronoi.m, scripts/image/imagesc.m, scripts/plot/__plt_get_axis_arg__.m, scripts/plot/axes.m, scripts/plot/cla.m, scripts/plot/colorbar.m, scripts/plot/hold.m, scripts/plot/legend.m, scripts/plot/plotmatrix.m, scripts/plot/plotyy.m, scripts/plot/private/__errplot__.m, scripts/plot/private/__plt__.m, scripts/plot/view.m: Use new isaxes function to simplify code. * scripts/plot/shading.m: Use Octave convention for spacing of parentheses. * scripts/plot/zlabel.m: Correct %!test incorrectly calling plot3 with figure handle.
author Rik <rik@octave.org>
date Wed, 31 Jul 2013 16:27:49 -0700
parents eaab03308c0b
children df4c4b7708a4
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})
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
25 ## @deftypefnx {Function File} {} contour3 (@var{hax}, @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{})
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
27 ## Create a 3-D contour plot.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
28 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
29 ## @code{contour3} plots level curves (contour lines) of the matrix @var{z}
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
30 ## at a Z level corresponding to each contour. This is in contrast to
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
31 ## @code{contour} which plots all of the contour lines at the same Z level
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
32 ## and produces a 2-D plot.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
33 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
34 ## The level curves are taken from the contour matrix @var{c} computed by
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
35 ## @code{contourc} for the same arguments; see the latter for their
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
36 ## interpretation.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
37 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
38 ## The appearance of contour lines can be defined with a line style @var{style}
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
39 ## in the same manner as @code{plot}. Only line style and color are used;
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
40 ## Any markers defined by @var{style} are ignored.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
41 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
42 ## If the first argument @var{hax} is an axes handle, then plot into this axis,
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
43 ## rather than the current axes returned by @code{gca}.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
44 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
45 ## The optional output @var{c} are the contour levels in @code{contourc} format.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
46 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
47 ## The optional return value @var{h} is a graphics handle to the hggroup
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
48 ## comprising the contour lines.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
49 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
50 ## Example:
7175
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 ## @example
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
53 ## @group
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
54 ## contour3 (peaks (19));
16814
64e7bb01fce2 doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents: 14335
diff changeset
55 ## hold on;
14327
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
56 ## surface (peaks (19), "facecolor", "none", "EdgeColor", "black");
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
57 ## colormap hot;
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
58 ## @end group
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
59 ## @end example
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
60 ##
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
61 ## @seealso{contour, contourc, contourf, clabel, meshc, surfc, caxis, colormap, plot}
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
62 ## @end deftypefn
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
63
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
64 function [c, h] = contour3 (varargin)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
65
17050
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
66 [hax, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
67
17050
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
68 oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
69 unwind_protect
17050
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
70 hax = newplot (hax);
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
71
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
72 [ctmp, htmp] = __contour__ (hax, "auto", varargin{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
73 unwind_protect_cleanup
17050
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
74 if (! isempty (oldfig))
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
75 set (0, "currentfigure", oldfig);
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
76 endif
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7175
diff changeset
77 end_unwind_protect
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
78
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
79 if (! ishold ())
17050
9ff7d4849f03 contour[3f].m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
80 set (hax, "view", [-37.5, 30],
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17050
diff changeset
81 "xgrid", "on", "ygrid", "on", "zgrid", "on");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
82 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
83
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
84 if (nargout > 0)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
85 c = ctmp;
8289
ac7f334d9652 Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents: 7317
diff changeset
86 h = htmp;
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
87 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
88
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents:
diff changeset
89 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
90
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
91
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
92 %!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
93 %! clf;
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7216
diff changeset
94 %! 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
95 %! hold on;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
96 %! surface (peaks (19), 'facecolor', 'none', 'edgecolor', 'black');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
97 %! 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
98 %! 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
99 %! 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
100 %! 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
101 %! 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
102