Mercurial > hg > octave-lyh
annotate scripts/plot/surf.m @ 16923:5d08a2ec7edb
doc: Move graphics object functions into the right section
* plot.txi: Merge node "Use of axis, line, and patch Functions" into
node "Graphics Objects".
* octave.texi: Remove node "Use of axis, line, and patch Functions"
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Mon, 08 Jul 2013 09:13:30 -0400 |
parents | c4fa5e0b6193 |
children | 1118d566bcd4 |
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 Kai Habel |
7109 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
20 ## @deftypefn {Function File} {} surf (@var{x}, @var{y}, @var{z}) |
11101
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
10549
diff
changeset
|
21 ## @deftypefnx {Function File} {} surf (@var{z}) |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
10549
diff
changeset
|
22 ## @deftypefnx {Function File} {} surf (@dots{}, @var{c}) |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
10549
diff
changeset
|
23 ## @deftypefnx {Function File} {} surf (@var{hax}, @dots{}) |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
24 ## @deftypefnx {Function File} {@var{h} =} surf (@dots{}) |
7109 | 25 ## Plot a surface given matrices @var{x}, and @var{y} from @code{meshgrid} and |
26 ## a matrix @var{z} corresponding to the @var{x} and @var{y} coordinates of | |
27 ## the mesh. If @var{x} and @var{y} are vectors, then a typical vertex | |
28 ## is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, columns of @var{z} | |
29 ## correspond to different @var{x} values and rows of @var{z} correspond | |
30 ## to different @var{y} values. | |
11101
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
10549
diff
changeset
|
31 ## |
11575
d6619410e79c
Spellcheck documentation before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11563
diff
changeset
|
32 ## The color of the surface is derived from the @code{colormap} and |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
33 ## the value of @var{z}. Optionally the color of the surface can be |
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
34 ## specified independent of @var{z}, by adding a fourth matrix, @var{c}. |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
35 ## |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
36 ## 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:
12812
diff
changeset
|
37 ## surface object. |
11101
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
10549
diff
changeset
|
38 ## @seealso{colormap, contour, meshgrid, mesh} |
7109 | 39 ## @end deftypefn |
40 | |
7110 | 41 ## Author: Kai Habel <kai.habel@gmx.de> |
7109 | 42 |
7216 | 43 function retval = surf (varargin) |
7109 | 44 |
7215 | 45 [h, varargin] = __plt_get_axis_arg__ ("surf", varargin{:}); |
7109 | 46 |
7215 | 47 oldh = gca (); |
48 unwind_protect | |
49 axes (h); | |
50 newplot (); | |
51 tmp = surface (varargin{:}); | |
7110 | 52 |
7215 | 53 if (! ishold ()) |
7298 | 54 set (h, "view", [-37.5, 30], |
10549 | 55 "xgrid", "on", "ygrid", "on", "zgrid", "on"); |
7215 | 56 endif |
57 unwind_protect_cleanup | |
58 axes (oldh); | |
59 end_unwind_protect | |
7110 | 60 |
7109 | 61 if (nargout > 0) |
7216 | 62 retval = tmp; |
7109 | 63 endif |
64 | |
65 endfunction | |
12812
4c93cc41da15
codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents:
11575
diff
changeset
|
66 |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
67 |
12812
4c93cc41da15
codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents:
11575
diff
changeset
|
68 %!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
|
69 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
70 %! colormap ('default'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
71 %! [~,~,Z] = peaks (); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
72 %! surf (Z); |
12812
4c93cc41da15
codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents:
11575
diff
changeset
|
73 |
4c93cc41da15
codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents:
11575
diff
changeset
|
74 %!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
|
75 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
76 %! colormap ('default'); |
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 %! [~,~,Z] = sombrero (); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
78 %! [Fx,Fy] = gradient (Z); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
79 %! surf (Z, Fx+Fy); |
12812
4c93cc41da15
codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents:
11575
diff
changeset
|
80 %! shading interp; |
4c93cc41da15
codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents:
11575
diff
changeset
|
81 |
4c93cc41da15
codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents:
11575
diff
changeset
|
82 %!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
|
83 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
84 %! colormap ('default'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
85 %! [X,Y,Z] = sombrero (); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
86 %! [~,Fy] = gradient (Z); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
87 %! surf (X, Y, Z, Fy); |
12812
4c93cc41da15
codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents:
11575
diff
changeset
|
88 %! shading interp; |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
12812
diff
changeset
|
89 |