annotate scripts/plot/surface.m @ 13141:e81ddf9cacd5

maint: untabify and remove trailing whitespace from source files * bicg.m, gmres.m, pkg.m: Untabify and remove trailing whitespace. * libcruft/Makefile.am, libcruft/blas-xtra/cdotc3.f, libcruft/blas-xtra/cmatm3.f, libcruft/blas-xtra/ddot3.f, libcruft/blas-xtra/dmatm3.f, libcruft/blas-xtra/sdot3.f, libcruft/blas-xtra/smatm3.f, libcruft/blas-xtra/zdotc3.f, libcruft/blas-xtra/zmatm3.f, libcruft/lapack-xtra/crsf2csf.f, libcruft/lapack-xtra/zrsf2csf.f, liboctave/Array.cc, liboctave/DASPK-opts.in, liboctave/DASRT-opts.in, liboctave/DASSL-opts.in, liboctave/LSODE-opts.in, liboctave/Makefile.a,mliboctave/Quad-opts.in, liboctave/Sparse-perm-op-defs.h, scripts/Makefile.a,mscripts/deprecated/glpkmex.m, scripts/general/blkdiag.m, scripts/general/interp1.m, scripts/general/profshow.m, scripts/general/quadl.m, scripts/general/triplequad.m, scripts/help/__makeinfo__.m, scripts/io/strread.m, scripts/io/textread.m, scripts/io/textscan.m, scripts/linear-algebra/rank.m, scripts/miscellaneous/gzip.m, scripts/miscellaneous/private/__xzip__.m, scripts/miscellaneous/tempdir.m, scripts/miscellaneous/unpack.m, scripts/pkg/pkg.m, scripts/plot/allchild.m, scripts/plot/ancestor.m, scripts/plot/cla.m, scripts/plot/clf.m, scripts/plot/findall.m, scripts/plot/findobj.m, scripts/plot/gca.m, scripts/plot/gcf.m, scripts/plot/hggroup.m, scripts/plot/isfigure.m, scripts/plot/ishghandle.m, scripts/plot/legend.m, scripts/plot/line.m, scripts/plot/loglog.m, scripts/plot/patch.m, scripts/plot/print.m, scripts/plot/private/__quiver__.m, scripts/plot/private/__scatter__.m, scripts/plot/rectangle.m, scripts/plot/semilogx.m, scripts/plot/semilogy.m, scripts/plot/surface.m, scripts/plot/text.m, scripts/plot/title.m, scripts/plot/trisurf.m, scripts/plot/view.m, scripts/plot/whitebg.m, scripts/plot/xlabel.m, scripts/plot/xlim.m, scripts/plot/ylabel.m, scripts/plot/ylim.m, scripts/plot/zlabel.m, scripts/plot/zlim.m, scripts/polynomial/mkpp.m, scripts/polynomial/polygcd.m, scripts/polynomial/ppint.m, scripts/polynomial/ppjumps.m, scripts/polynomial/ppval.m, scripts/set/setxor.m, scripts/sparse/bicgstab.m, scripts/sparse/cgs.m, scripts/sparse/spconvert.m, scripts/specfun/nthroot.m, scripts/strings/strmatch.m, scripts/strings/untabify.m, scripts/testfun/demo.m, scripts/testfun/example.m, src/DLD-FUNCTIONS/filter.cc, src/DLD-FUNCTIONS/mgorth.cc, src/DLD-FUNCTIONS/quadcc.cc, src/DLD-FUNCTIONS/str2double.cc, src/Makefile.a,msrc/gl-render.cc, src/gl2ps-renderer.cc, src/graphics.cc, src/octave-config.cc.in, src/octave-config.in, src/ov-class.h, src/ov-fcn.h, src/profiler.cc, src/profiler.h, src/pt-binop.cc, src/pt-unop.cc, src/symtab.cc, src/txt-eng-ft.cc: Remove trailing whitespace.
author John W. Eaton <jwe@octave.org>
date Thu, 15 Sep 2011 12:51:10 -0400
parents 2ea1658ad049
children 3e1871badab9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11472
diff changeset
1 ## Copyright (C) 1993-2011 John W. Eaton
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
2 ##
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
4 ##
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
9 ##
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
14 ##
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
18
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
10634
60542efcfa2c Check input arguments for size and type (bug #29861).
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
20 ## @deftypefn {Function File} {} surface (@var{x}, @var{y}, @var{z}, @var{c})
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
21 ## @deftypefnx {Function File} {} surface (@var{x}, @var{y}, @var{z})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
22 ## @deftypefnx {Function File} {} surface (@var{z}, @var{c})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
23 ## @deftypefnx {Function File} {} surface (@var{z})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
24 ## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val})
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
25 ## @deftypefnx {Function File} {} surface (@var{h}, @dots{})
7650
eb7bdde776f2 Texinfo fixes
John W. Eaton <jwe@octave.org>
parents: 7298
diff changeset
26 ## @deftypefnx {Function File} {@var{h} =} surface (@dots{})
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
27 ## Plot a surface graphic object given matrices @var{x}, and @var{y} from
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
28 ## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
29 ## @var{y} coordinates of the surface. If @var{x} and @var{y} are vectors,
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
30 ## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus,
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
31 ## columns of @var{z} correspond to different @var{x} values and rows of
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
32 ## @var{z} correspond to different @var{y} values. If @var{x} and @var{y}
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
33 ## are missing, they are constructed from size of the matrix @var{z}.
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
34 ##
8347
fa78cb8d8a5c corrections for typos
Brian Gough<bjg@network-theory.co.uk>
parents: 7650
diff changeset
35 ## Any additional properties passed are assigned to the surface.
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
36 ## @seealso{surf, mesh, patch, line}
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
37 ## @end deftypefn
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
38
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
39 ## Author: jwe
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
40
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
41 function retval = surface (varargin)
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
42
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
43 [h, varargin] = __plt_get_axis_arg__ ("surface", varargin{:});
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
44
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
45 oldh = gca ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
46 unwind_protect
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
47 axes (h);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
48 [tmp, bad_usage] = __surface__ (h, varargin{:});
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
49 unwind_protect_cleanup
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
50 axes (oldh);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
51 end_unwind_protect
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
52
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
53 if (bad_usage)
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
54 print_usage ();
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
55 endif
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
56
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
57 if (nargout > 0)
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
58 retval = tmp;
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
59 endif
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
60
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
61 endfunction
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
62
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
63 function [h, bad_usage] = __surface__ (ax, varargin)
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
64
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
65 bad_usage = false;
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
66 h = 0;
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
67 firststring = nargin;
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
68 for i = 2 : nargin
7208
a730e47fda4d [project @ 2007-11-28 02:32:41 by jwe]
jwe
parents: 7207
diff changeset
69 if (ischar (varargin{i - 1}))
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
70 firststring = i - 1;
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
71 break;
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
72 endif
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
73 endfor
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
74
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
75 if (firststring > 5)
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
76 bad_usage = true;
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
77 elseif (firststring == 5)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
78 x = varargin{1};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
79 y = varargin{2};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
80 z = varargin{3};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
81 c = varargin{4};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
82
7110
0e63f1126f01 [project @ 2007-11-06 22:36:22 by jwe]
jwe
parents: 7109
diff changeset
83 if (! size_equal (z, c))
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
84 error ("surface: Z and C must have the same size");
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
85 endif
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
86 if (isvector (x) && isvector (y) && ismatrix (z))
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
87 if (rows (z) == length (y) && columns (z) == length (x))
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
88 x = x(:)';
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
89 y = y(:);
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
90 else
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
91 error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
92 endif
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
93 elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7284
diff changeset
94 if (! size_equal (x, y, z))
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
95 error ("surface: X, Y, and Z must have the same dimensions");
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
96 endif
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
97 else
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
98 error ("surface: X and Y must be vectors and Z must be a matrix");
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
99 endif
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
100 elseif (firststring == 4)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
101 x = varargin{1};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
102 y = varargin{2};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
103 z = varargin{3};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
104 c = z;
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
105 if (isvector (x) && isvector (y) && ismatrix (z))
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
106 if (rows (z) == length (y) && columns (z) == length (x))
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
107 x = x(:)';
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
108 y = y(:);
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
109 else
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
110 error ("surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
111 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
112 elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7284
diff changeset
113 if (! size_equal (x, y, z))
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
114 error ("surface: X, Y, and Z must have the same dimensions");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
115 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
116 else
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
117 error ("surface: X and Y must be vectors and Z must be a matrix");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
118 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
119 elseif (firststring == 3)
7208
a730e47fda4d [project @ 2007-11-28 02:32:41 by jwe]
jwe
parents: 7207
diff changeset
120 z = varargin{1};
a730e47fda4d [project @ 2007-11-28 02:32:41 by jwe]
jwe
parents: 7207
diff changeset
121 c = varargin{2};
10634
60542efcfa2c Check input arguments for size and type (bug #29861).
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
122 if (ismatrix (z) && !isvector (z) && !isscalar (z))
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
123 [nr, nc] = size (z);
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
124 x = 1:nc;
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
125 y = (1:nr)';
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
126 else
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
127 error ("surface: Z argument must be a matrix");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
128 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
129 elseif (firststring == 2)
7208
a730e47fda4d [project @ 2007-11-28 02:32:41 by jwe]
jwe
parents: 7207
diff changeset
130 z = varargin{1};
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
131 c = z;
10634
60542efcfa2c Check input arguments for size and type (bug #29861).
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
132 if (ismatrix (z) && !isvector (z) && !isscalar (z))
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
133 [nr, nc] = size (z);
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
134 x = 1:nc;
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
135 y = (1:nr)';
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
136 else
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10634
diff changeset
137 error ("surface: Z argument must be a matrix");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
138 endif
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
139 elseif (firststring == 1)
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
140 x = 1:3;
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
141 y = (x).';
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
142 c = z = eye(3);
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
143 else
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
144 bad_usage = true;
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7175
diff changeset
145 endif
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
146
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
147 if (! bad_usage)
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
148 ## Make a default surface object.
7277
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7216
diff changeset
149 other_args = {};
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
150 if (firststring < nargin)
7277
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7216
diff changeset
151 other_args = varargin(firststring:end);
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7216
diff changeset
152 endif
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7216
diff changeset
153 h = __go_surface__ (ax, "xdata", x, "ydata", y, "zdata", z, "cdata", c,
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
154 other_args{:});
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
155
7277
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7216
diff changeset
156 if (! ishold ())
7298
d42d8c43d3e7 [project @ 2007-12-11 21:49:31 by jwe]
jwe
parents: 7293
diff changeset
157 set (ax, "view", [0, 90], "box", "off");
7277
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7216
diff changeset
158 endif
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7216
diff changeset
159 endif
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
160
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
161 endfunction
12817
e3e6079039c6 codesprint: 2 demos for pcolor.m dummy for surface.m
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
162
12819
66af8b914607 codesprint: Add comment for dummy test in surface.m, Fix typo in wavread.m
Kai Habel <kai.habel@gmx.de>
parents: 12817
diff changeset
163 ## Mark file as being tested. Tests for surface are in
66af8b914607 codesprint: Add comment for dummy test in surface.m, Fix typo in wavread.m
Kai Habel <kai.habel@gmx.de>
parents: 12817
diff changeset
164 ## surf.m, surfc.m, surfl.m, and pcolor.m
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
165
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
166 %!test
13124
2ea1658ad049 Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents: 13115
diff changeset
167 %! hf = figure ("visible", "off");
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 13124
diff changeset
168 %! unwind_protect
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
169 %! h = surface;
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
170 %! assert (findobj (hf, "type", "surface"), h);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
171 %! assert (get (h, "xdata"), 1:3, eps);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
172 %! assert (get (h, "ydata"), (1:3)', eps);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
173 %! assert (get (h, "zdata"), eye(3));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
174 %! assert (get (h, "cdata"), eye(3));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
175 %! assert (get (h, "type"), "surface");
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
176 %! assert (get (h, "linestyle"), get (0, "defaultsurfacelinestyle"));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
177 %! assert (get (h, "linewidth"), get (0, "defaultsurfacelinewidth"), eps);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
178 %! assert (get (h, "marker"), get (0, "defaultsurfacemarker"));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
179 %! assert (get (h, "markersize"), get (0, "defaultsurfacemarkersize"));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
180 %! unwind_protect_cleanup
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
181 %! close (hf);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12819
diff changeset
182 %! end_unwind_protect