annotate scripts/plot/draw/surface.m @ 17572:7bb76a22cde1

maint: Split scripts/plot directory into 4 pieces. scripts/gui : user-interface functions scripts/plot/appearance : functions controlling plot appearance scripts/plot/draw : plotting functions which produce graphs scripts/plot/util : low-level plotting functions and utilities. * scripts/gui/guidata.m, scripts/gui/guihandles.m, scripts/gui/module.mk, scripts/gui/private/__file_filter__.m, scripts/gui/private/__fltk_file_filter__.m, scripts/gui/private/__is_function__.m, scripts/gui/private/__uigetdir_fltk__.m, scripts/gui/private/__uigetfile_fltk__.m, scripts/gui/private/__uiobject_split_args__.m, scripts/gui/private/__uiputfile_fltk__.m, scripts/gui/uicontextmenu.m, scripts/gui/uicontrol.m, scripts/gui/uigetdir.m, scripts/gui/uigetfile.m, scripts/gui/uimenu.m, scripts/gui/uipanel.m, scripts/gui/uipushtool.m, scripts/gui/uiputfile.m, scripts/gui/uiresume.m, scripts/gui/uitoggletool.m, scripts/gui/uitoolbar.m, scripts/gui/uiwait.m, scripts/gui/waitbar.m, scripts/gui/waitforbuttonpress.m: Moved from scripts/plot to scripts/gui * scripts/plot/appearance/__clabel__.m, scripts/plot/appearance/__getlegenddata__.m, scripts/plot/appearance/axis.m, scripts/plot/appearance/box.m, scripts/plot/appearance/caxis.m, scripts/plot/appearance/clabel.m, scripts/plot/appearance/daspect.m, scripts/plot/appearance/diffuse.m, scripts/plot/appearance/grid.m, scripts/plot/appearance/gtext.m, scripts/plot/appearance/hidden.m, scripts/plot/appearance/legend.m, scripts/plot/appearance/orient.m, scripts/plot/appearance/pbaspect.m, scripts/plot/appearance/private/__axis_label__.m, scripts/plot/appearance/private/__axis_limits__.m, scripts/plot/appearance/shading.m, scripts/plot/appearance/specular.m, scripts/plot/appearance/text.m, scripts/plot/appearance/title.m, scripts/plot/appearance/view.m, scripts/plot/appearance/whitebg.m, scripts/plot/appearance/xlabel.m, scripts/plot/appearance/xlim.m, scripts/plot/appearance/ylabel.m, scripts/plot/appearance/ylim.m, scripts/plot/appearance/zlabel.m, scripts/plot/appearance/zlim.m: Moved from scripts/plot to subdir appearance. * scripts/plot/draw/area.m, scripts/plot/draw/bar.m, scripts/plot/draw/barh.m, scripts/plot/draw/colorbar.m, scripts/plot/draw/comet.m, scripts/plot/draw/comet3.m, scripts/plot/draw/compass.m, scripts/plot/draw/contour.m, scripts/plot/draw/contour3.m, scripts/plot/draw/contourc.m, scripts/plot/draw/contourf.m, scripts/plot/draw/cylinder.m, scripts/plot/draw/ellipsoid.m, scripts/plot/draw/errorbar.m, scripts/plot/draw/ezcontour.m, scripts/plot/draw/ezcontourf.m, scripts/plot/draw/ezmesh.m, scripts/plot/draw/ezmeshc.m, scripts/plot/draw/ezplot.m, scripts/plot/draw/ezplot3.m, scripts/plot/draw/ezpolar.m, scripts/plot/draw/ezsurf.m, scripts/plot/draw/ezsurfc.m, scripts/plot/draw/feather.m, scripts/plot/draw/fill.m, scripts/plot/draw/fplot.m, scripts/plot/draw/hist.m, scripts/plot/draw/isocolors.m, scripts/plot/draw/isonormals.m, scripts/plot/draw/isosurface.m, scripts/plot/draw/line.m, scripts/plot/draw/loglog.m, scripts/plot/draw/loglogerr.m, scripts/plot/draw/mesh.m, scripts/plot/draw/meshc.m, scripts/plot/draw/meshz.m, scripts/plot/draw/pareto.m, scripts/plot/draw/patch.m, scripts/plot/draw/pcolor.m, scripts/plot/draw/peaks.m, scripts/plot/draw/pie.m, scripts/plot/draw/pie3.m, scripts/plot/draw/plot.m, scripts/plot/draw/plot3.m, scripts/plot/draw/plotmatrix.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m, scripts/plot/draw/private/__add_datasource__.m, scripts/plot/draw/private/__bar__.m, scripts/plot/draw/private/__contour__.m, scripts/plot/draw/private/__errcomm__.m, scripts/plot/draw/private/__errplot__.m, scripts/plot/draw/private/__ezplot__.m, scripts/plot/draw/private/__interp_cube__.m, scripts/plot/draw/private/__line__.m, scripts/plot/draw/private/__marching_cube__.m, scripts/plot/draw/private/__patch__.m, scripts/plot/draw/private/__pie__.m, scripts/plot/draw/private/__plt__.m, scripts/plot/draw/private/__quiver__.m, scripts/plot/draw/private/__scatter__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/quiver.m, scripts/plot/draw/quiver3.m, scripts/plot/draw/rectangle.m, scripts/plot/draw/ribbon.m, scripts/plot/draw/rose.m, scripts/plot/draw/scatter.m, scripts/plot/draw/scatter3.m, scripts/plot/draw/semilogx.m, scripts/plot/draw/semilogxerr.m, scripts/plot/draw/semilogy.m, scripts/plot/draw/semilogyerr.m, scripts/plot/draw/shrinkfaces.m, scripts/plot/draw/slice.m, scripts/plot/draw/sombrero.m, scripts/plot/draw/sphere.m, scripts/plot/draw/stairs.m, scripts/plot/draw/stem.m, scripts/plot/draw/stem3.m, scripts/plot/draw/stemleaf.m, scripts/plot/draw/surf.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfc.m, scripts/plot/draw/surfl.m, scripts/plot/draw/surfnorm.m, scripts/plot/draw/tetramesh.m, scripts/plot/draw/trimesh.m, scripts/plot/draw/triplot.m, scripts/plot/draw/trisurf.m, scripts/plot/draw/waterfall.m: Moved from plot/ to subdir draw. * scripts/plot/util/__actual_axis_position__.m, scripts/plot/util/__default_plot_options__.m, scripts/plot/util/__gnuplot_drawnow__.m, scripts/plot/util/__next_line_color__.m, scripts/plot/util/__next_line_style__.m, scripts/plot/util/__plt_get_axis_arg__.m, scripts/plot/util/__pltopt__.m, scripts/plot/util/allchild.m, scripts/plot/util/ancestor.m, scripts/plot/util/axes.m, scripts/plot/util/cla.m, scripts/plot/util/clf.m, scripts/plot/util/close.m, scripts/plot/util/closereq.m, scripts/plot/util/colstyle.m, scripts/plot/util/copyobj.m, scripts/plot/util/figure.m, scripts/plot/util/findall.m, scripts/plot/util/findfigs.m, scripts/plot/util/findobj.m, scripts/plot/util/gca.m, scripts/plot/util/gcbf.m, scripts/plot/util/gcbo.m, scripts/plot/util/gcf.m, scripts/plot/util/gco.m, scripts/plot/util/ginput.m, scripts/plot/util/gnuplot_binary.in, scripts/plot/util/graphics_toolkit.m, scripts/plot/util/hdl2struct.m, scripts/plot/util/hggroup.m, scripts/plot/util/hold.m, scripts/plot/util/isaxes.m, scripts/plot/util/isfigure.m, scripts/plot/util/ishghandle.m, scripts/plot/util/ishold.m, scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m, scripts/plot/util/meshgrid.m, scripts/plot/util/ndgrid.m, scripts/plot/util/newplot.m, scripts/plot/util/print.m, scripts/plot/util/printd.m, scripts/plot/util/private/__add_default_menu__.m, scripts/plot/util/private/__fltk_ginput__.m, scripts/plot/util/private/__fltk_print__.m, scripts/plot/util/private/__ghostscript__.m, scripts/plot/util/private/__gnuplot_get_var__.m, scripts/plot/util/private/__gnuplot_ginput__.m, scripts/plot/util/private/__gnuplot_has_feature__.m, scripts/plot/util/private/__gnuplot_has_terminal__.m, scripts/plot/util/private/__gnuplot_open_stream__.m, scripts/plot/util/private/__gnuplot_print__.m, scripts/plot/util/private/__gnuplot_version__.m, scripts/plot/util/private/__go_draw_axes__.m, scripts/plot/util/private/__go_draw_figure__.m, scripts/plot/util/private/__print_parse_opts__.m, scripts/plot/util/private/__tight_eps_bbox__.m, scripts/plot/util/refresh.m, scripts/plot/util/refreshdata.m, scripts/plot/util/saveas.m, scripts/plot/util/shg.m, scripts/plot/util/struct2hdl.m, scripts/plot/util/subplot.m: Moved from plot to subdir util. * etc/HACKING: Updated directory structure info. * scripts/Makefile.am, scripts/plot/appearance/module.mk, scripts/plot/draw/module.mk, scripts/plot/util/module.mk: Added new directories to build system.
author Rik <rik@octave.org>
date Fri, 04 Oct 2013 17:09:08 -0700
parents scripts/plot/surface.m@eaab03308c0b
children 1ab8e21d9cfc
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: 14001
diff changeset
1 ## Copyright (C) 1993-2012 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})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
24 ## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val}, @dots{})
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
25 ## @deftypefnx {Function File} {} surface (@var{hax}, @dots{})
7650
eb7bdde776f2 Texinfo fixes
John W. Eaton <jwe@octave.org>
parents: 7298
diff changeset
26 ## @deftypefnx {Function File} {@var{h} =} surface (@dots{})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
27 ## Create a surface graphic object given matrices @var{x} and @var{y} from
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
28 ## @code{meshgrid} and a matrix of values @var{z} corresponding to the
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
29 ## @var{x} and @var{y} coordinates of the surface.
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
30 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
31 ## If @var{x} and @var{y} are vectors, then a typical vertex is
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
32 ## (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, columns of @var{z} correspond
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
33 ## to different @var{x} values and rows of @var{z} correspond to different
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
34 ## @var{y} values. If only a single input @var{z} is given then @var{x} is
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
35 ## taken to be @code{1:rows (@var{z})} and @var{y} is
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
36 ## @code{1:columns (@var{z})}.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
37 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
38 ## Any property/value input pairs are assigned to the surface object.
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13194
diff changeset
39 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
40 ## 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: 17040
diff changeset
41 ## rather than the current axes returned by @code{gca}.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17040
diff changeset
42 ##
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13194
diff changeset
43 ## The optional return value @var{h} is a graphics handle to the created
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13194
diff changeset
44 ## surface object.
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
45 ## @seealso{surf, mesh, patch, line}
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
46 ## @end deftypefn
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
47
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
48 ## Author: jwe
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
49
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
50 function h = surface (varargin)
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
51
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
52 [hax, varargin] = __plt_get_axis_arg__ ("surface", varargin{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
53
17040
55b76fd1244b surface.m: Update to use new __plt_get_axis_arg__ without using "axes" function.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16986
diff changeset
54 if (isempty (hax))
55b76fd1244b surface.m: Update to use new __plt_get_axis_arg__ without using "axes" function.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16986
diff changeset
55 hax = gca ();
55b76fd1244b surface.m: Update to use new __plt_get_axis_arg__ without using "axes" function.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16986
diff changeset
56 endif
55b76fd1244b surface.m: Update to use new __plt_get_axis_arg__ without using "axes" function.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16986
diff changeset
57
55b76fd1244b surface.m: Update to use new __plt_get_axis_arg__ without using "axes" function.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16986
diff changeset
58 [htmp, bad_usage] = __surface__ (hax, varargin{:});
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
59
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
60 if (bad_usage)
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
61 print_usage ();
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
62 endif
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
63
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
64 if (nargout > 0)
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
65 h = htmp;
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
66 endif
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
67
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
68 endfunction
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
69
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
70 function [h, bad_usage] = __surface__ (ax, varargin)
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
71
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
72 h = 0;
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
73 bad_usage = false;
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
74 firststring = nargin;
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
75 for i = 1 : (nargin - 1)
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
76 if (ischar (varargin{i}))
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
77 firststring = i;
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
78 break;
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
79 endif
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
80 endfor
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
81
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
82 if (firststring > 5)
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
83 bad_usage = true;
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
84 return;
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
85 elseif (firststring == 5)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
86 x = varargin{1};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
87 y = varargin{2};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
88 z = varargin{3};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
89 c = varargin{4};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
90
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
91 if (iscomplex (x) || iscomplex (y) || iscomplex (z) || iscomplex (c))
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
92 error ("mesh: X, Y, Z, C arguments must be real");
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
93 endif
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
94
13194
3e1871badab9 allow sscanf to accept character arrays with more than one row
John W. Eaton <jwe@octave.org>
parents: 13141
diff changeset
95 [z_nr, z_nc] = size (z);
3e1871badab9 allow sscanf to accept character arrays with more than one row
John W. Eaton <jwe@octave.org>
parents: 13141
diff changeset
96 [c_nr, c_nc, c_np] = size (c);
3e1871badab9 allow sscanf to accept character arrays with more than one row
John W. Eaton <jwe@octave.org>
parents: 13141
diff changeset
97 if (! (z_nr == c_nr && z_nc == c_nc && (c_np == 1 || c_np == 3)))
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: Z and C must have the same size");
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
99 endif
13194
3e1871badab9 allow sscanf to accept character arrays with more than one row
John W. Eaton <jwe@octave.org>
parents: 13141
diff changeset
100
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
101 if (isvector (x) && isvector (y) && ismatrix (z))
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
102 if (rows (z) == length (y) && columns (z) == length (x))
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
103 x = x(:)';
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
104 y = y(:);
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
105 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
106 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
107 endif
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
108 elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7284
diff changeset
109 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
110 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
111 endif
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
112 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
113 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
114 endif
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
115 elseif (firststring == 4)
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
116 x = varargin{1};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
117 y = varargin{2};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
118 z = varargin{3};
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
119 c = z;
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
120
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
121 if (iscomplex (x) || iscomplex (y) || iscomplex (z))
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
122 error ("mesh: X, Y, Z arguments must be real");
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
123 endif
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
124
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
125 if (isvector (x) && isvector (y) && ismatrix (z))
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
126 if (rows (z) == length (y) && columns (z) == length (x))
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
127 x = x(:)';
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
128 y = y(:);
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
129 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
130 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
131 endif
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
132 elseif (ismatrix (x) && ismatrix (y) && ismatrix (z))
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7284
diff changeset
133 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
134 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
135 endif
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: 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
138 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
139 elseif (firststring == 3)
7208
a730e47fda4d [project @ 2007-11-28 02:32:41 by jwe]
jwe
parents: 7207
diff changeset
140 z = varargin{1};
a730e47fda4d [project @ 2007-11-28 02:32:41 by jwe]
jwe
parents: 7207
diff changeset
141 c = varargin{2};
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
142
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
143 if (iscomplex (z) || iscomplex (c))
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
144 error ("mesh: X, C arguments must be real");
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
145 endif
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
146
10634
60542efcfa2c Check input arguments for size and type (bug #29861).
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
147 if (ismatrix (z) && !isvector (z) && !isscalar (z))
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
148 [nr, nc] = size (z);
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
149 x = 1:nc;
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
150 y = (1:nr)';
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
151 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
152 error ("surface: Z argument must be a matrix");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
153 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
154 elseif (firststring == 2)
7208
a730e47fda4d [project @ 2007-11-28 02:32:41 by jwe]
jwe
parents: 7207
diff changeset
155 z = varargin{1};
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
156 c = z;
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
157
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
158 if (iscomplex (z))
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
159 error ("mesh: Z argument must be real");
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
160 endif
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
161
10634
60542efcfa2c Check input arguments for size and type (bug #29861).
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
162 if (ismatrix (z) && !isvector (z) && !isscalar (z))
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
163 [nr, nc] = size (z);
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
164 x = 1:nc;
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
165 y = (1:nr)';
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
166 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
167 error ("surface: Z argument must be a matrix");
7175
5ff4da7bd2e7 [project @ 2007-11-14 20:36:48 by jwe]
jwe
parents: 7146
diff changeset
168 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
169 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
170 x = 1:3;
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
171 y = x';
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
172 c = z = eye (3);
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
173 else
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7191
diff changeset
174 bad_usage = true;
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
175 return;
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7175
diff changeset
176 endif
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
177
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
178 if (firststring < nargin)
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
179 other_args = varargin(firststring:end);
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
180 else
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
181 other_args = {}; # make a default surface object.
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
182 endif
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
183 h = __go_surface__ (ax, "xdata", x, "ydata", y, "zdata", z, "cdata", c,
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
184 other_args{:});
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
185
16986
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
186 if (! ishold ())
df66488b8d43 surface.m: Validate inputs are not complex.
Rik <rik@octave.org>
parents: 14868
diff changeset
187 set (ax, "view", [0, 90], "box", "off");
7277
0c733917b6c8 [project @ 2007-12-10 20:14:39 by jwe]
jwe
parents: 7216
diff changeset
188 endif
7109
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
189
5436efbf35e3 [project @ 2007-11-06 22:16:25 by jwe]
jwe
parents:
diff changeset
190 endfunction
12817
e3e6079039c6 codesprint: 2 demos for pcolor.m dummy for surface.m
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
191
14223
ba7a26030214 Use Octave spacing convention in %!test blocks of surface plot functions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
192
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13194
diff changeset
193 ## Functional tests for surface() are in 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
194 %!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
195 %! 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
196 %! 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
197 %! 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
198 %! 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
199 %! 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
200 %! assert (get (h, "ydata"), (1:3)', eps);
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
201 %! assert (get (h, "zdata"), eye (3));
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
202 %! assert (get (h, "cdata"), eye (3));
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
203 %! 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
204 %! 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
205 %! 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
206 %! 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
207 %! 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
208 %! 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
209 %! 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
210 %! end_unwind_protect
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13194
diff changeset
211