Mercurial > hg > octave-nkf
annotate scripts/plot/meshc.m @ 17049:0322e057697f
hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
* scripts/plot/box.m: Update to use new __plt_get_axis_arg__.
Use hax instead of ax. Redo docstring.
* scripts/plot/grid.m: Update to use new __plt_get_axis_arg__.
Use hax instead of ax. Redo docstring. Move input validation
to front of function.
* scripts/plot/hold.m: Update to use new __plt_get_axis_arg__.
Use hax instead of ax. Redo docstring. Add 2 new %!demos.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Tue, 23 Jul 2013 15:10:57 +0200 |
parents | c9346014fed2 |
children | 328b579e08e9 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
12133
diff
changeset
|
1 ## Copyright (C) 1996-2012 John W. Eaton |
6788 | 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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6788 | 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 | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6788 | 18 |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {} meshc (@var{x}, @var{y}, @var{z}) | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
21 ## Plot a mesh and contour 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
|
22 ## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
23 ## @var{y} coordinates of the mesh. If @var{x} and @var{y} are vectors, |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
24 ## 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
|
25 ## columns of @var{z} correspond to different @var{x} values and rows of |
6788 | 26 ## @var{z} correspond to different @var{y} values. |
27 ## @seealso{meshgrid, mesh, contour} | |
28 ## @end deftypefn | |
29 | |
30 function h = meshc (varargin) | |
31 | |
16985
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
32 if (! all (cellfun ("isreal", varargin))) |
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
33 error ("meshc: X, Y, Z, C arguments must be real"); |
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
34 endif |
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
35 |
6788 | 36 newplot (); |
37 | |
16985
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
38 htmp = surface (varargin{:}); |
7119 | 39 |
16985
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
40 ax = get (htmp, "parent"); |
6788 | 41 |
16985
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
42 set (htmp, "facecolor", "w"); |
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
43 set (htmp, "edgecolor", "flat"); |
12133
adbc08052ccd
meshc.m: Add note describing why the gnuplot backend is not consistent with Matlab.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
44 ## FIXME - gnuplot does not support a filled surface and a |
16985
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
45 ## non-filled contour. 3D filled patches are also not supported. |
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
46 ## Thus, the facecolor will be transparent for the gnuplot backend. |
6788 | 47 |
7146 | 48 if (! ishold ()) |
11427
dc983f92e774
contour3.m: Grid on be default for 3D plots.
Ben Abbott <bpabbott@mac.com>
parents:
11426
diff
changeset
|
49 set (ax, "view", [-37.5, 30], |
dc983f92e774
contour3.m: Grid on be default for 3D plots.
Ben Abbott <bpabbott@mac.com>
parents:
11426
diff
changeset
|
50 "xgrid", "on", "ygrid", "on", "zgrid", "on"); |
7146 | 51 endif |
6788 | 52 |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
53 drawnow (); |
11426
c503ccbe5033
Place contour for meshc/surfc at zlim(1)
Ben Abbott <bpabbott@mac.com>
parents:
7207
diff
changeset
|
54 zmin = get (ax, "zlim")(1); |
6788 | 55 |
16985
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
56 [~, htmp2] = __contour__ (ax, zmin, varargin{:}); |
6788 | 57 |
16985
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
58 htmp = [htmp; htmp2]; |
6788 | 59 |
60 if (nargout > 0) | |
16985
c9346014fed2
Validate inputs are real for mesh, meshc, meshz functions.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
61 h = htmp; |
6788 | 62 endif |
7119 | 63 |
6788 | 64 endfunction |