Mercurial > hg > octave-lyh
annotate scripts/plot/mesh.m @ 11427:dc983f92e774
contour3.m: Grid on be default for 3D plots.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 30 Dec 2010 20:18:15 -0500 |
parents | 1f9ab076f5f7 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2004, |
2 ## 2005, 2006, 2007 John W. Eaton | |
2313 | 3 ## |
4 ## This file is part of Octave. | |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
2313 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
15 ## | |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
245 | 19 |
3368 | 20 ## -*- texinfo -*- |
11101
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
21 ## @deftypefn {Function File} {} mesh (@var{x}, @var{y}, @var{z}) |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
22 ## @deftypefnx {Function File} {} mesh (@var{z}) |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
23 ## @deftypefnx {Function File} {} mesh (@dots{}, @var{c}) |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
24 ## @deftypefnx {Function File} {} mesh (@var{hax}, @dots{}) |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
25 ## @deftypefnx {Function File} {@var{h} = } mesh (@dots{}) |
6154 | 26 ## Plot a mesh given matrices @var{x}, and @var{y} from @code{meshgrid} and |
3368 | 27 ## a matrix @var{z} corresponding to the @var{x} and @var{y} coordinates of |
28 ## the mesh. If @var{x} and @var{y} are vectors, then a typical vertex | |
29 ## is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, columns of @var{z} | |
30 ## correspond to different @var{x} values and rows of @var{z} correspond | |
31 ## 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:
7149
diff
changeset
|
32 ## |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
33 ## The color of the mesh is derirved from the @code{colormap} |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
34 ## and the value of @var{z}. Optionally the color of the mesh can be |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
35 ## specified independent of of @var{z}, by adding a fourth matrix, @var{c}. |
1f9ab076f5f7
Include the 4 input (color) in the docstrings for mesh() and surf().
Ben Abbott <bpabbott@mac.com>
parents:
7149
diff
changeset
|
36 ## @seealso{colormap, contour, meshgrid, surf} |
3368 | 37 ## @end deftypefn |
4 | 38 |
2314 | 39 ## Author: jwe |
40 | |
7109 | 41 function h = mesh (varargin) |
6172 | 42 |
6390 | 43 newplot (); |
44 | |
7109 | 45 tmp = surface (varargin{:}); |
7110 | 46 |
47 ax = get (tmp, "parent"); | |
48 | |
7149 | 49 set (tmp, "facecolor", "w"); |
7110 | 50 set (tmp, "edgecolor", "flat"); |
51 | |
7146 | 52 if (! ishold ()) |
11427
dc983f92e774
contour3.m: Grid on be default for 3D plots.
Ben Abbott <bpabbott@mac.com>
parents:
11101
diff
changeset
|
53 set (ax, "view", [-37.5, 30], |
dc983f92e774
contour3.m: Grid on be default for 3D plots.
Ben Abbott <bpabbott@mac.com>
parents:
11101
diff
changeset
|
54 "xgrid", "on", "ygrid", "on", "zgrid", "on"); |
7146 | 55 endif |
7110 | 56 |
6257 | 57 if (nargout > 0) |
58 h = tmp; | |
6154 | 59 endif |
60 | |
4 | 61 endfunction |