annotate scripts/plot/surfc.m @ 14237:11949c9795a0

Revamp %!demos in m-files to use Octave coding conventions on spacing, etc. Add clf() to all demos using plot features to get reproducibility. Use 64 as input to all colormaps (jet (64)) to get reproducibility. * bicubic.m, cell2mat.m, celldisp.m, cplxpair.m, interp1.m, interp2.m, interpft.m, interpn.m, profile.m, profshow.m, convhull.m, delaunay.m, griddata.m, inpolygon.m, voronoi.m, autumn.m, bone.m, contrast.m, cool.m, copper.m, flag.m, gmap40.m, gray.m, hot.m, hsv.m, image.m, imshow.m, jet.m, ocean.m, pink.m, prism.m, rainbow.m, spring.m, summer.m, white.m, winter.m, condest.m, onenormest.m, axis.m, clabel.m, colorbar.m, comet.m, comet3.m, compass.m, contour.m, contour3.m, contourf.m, cylinder.m, daspect.m, ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, fplot.m, grid.m, hold.m, isosurface.m, legend.m, loglog.m, loglogerr.m, pareto.m, patch.m, pbaspect.m, pcolor.m, pie.m, pie3.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, rose.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, shading.m, slice.m, sombrero.m, stairs.m, stem.m, stem3.m, subplot.m, surf.m, surfc.m, surfl.m, surfnorm.m, text.m, title.m, trimesh.m, triplot.m, trisurf.m, uigetdir.m, uigetfile.m, uimenu.m, uiputfile.m, waitbar.m, xlim.m, ylim.m, zlim.m, mkpp.m, pchip.m, polyaffine.m, spline.m, bicgstab.m, cgs.m, gplot.m, pcg.m, pcr.m, treeplot.m, strtok.m, demo.m, example.m, rundemos.m, speed.m, test.m, calendar.m, datestr.m, datetick.m, weekday.m: Revamp %!demos to use Octave coding conventions on spacing, etc.
author Rik <octave@nomad.inbox5.com>
date Fri, 20 Jan 2012 12:59:53 -0800
parents ba7a26030214
children c4fa5e0b6193
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: 14092
diff changeset
1 ## Copyright (C) 1996-2012 John W. Eaton
7118
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
2 ##
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
4 ##
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
9 ##
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
14 ##
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
18
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
20 ## @deftypefn {Function File} {} surfc (@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 surface 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
7118
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
26 ## @var{z} correspond to different @var{y} values.
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
27 ## @seealso{meshgrid, surf, contour}
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
28 ## @end deftypefn
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
29
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
30 function h = surfc (varargin)
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
31
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
32 newplot ();
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
33
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
34 tmp = surface (varargin{:});
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
35
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
36 ax = get (tmp, "parent");
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
37
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
38 set (tmp, "facecolor", "flat");
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
39
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents: 7118
diff changeset
40 if (! ishold ())
11427
dc983f92e774 contour3.m: Grid on be default for 3D plots.
Ben Abbott <bpabbott@mac.com>
parents: 11426
diff changeset
41 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
42 "xgrid", "on", "ygrid", "on", "zgrid", "on");
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents: 7118
diff changeset
43 endif
7118
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
44
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
45 drawnow ();
11426
c503ccbe5033 Place contour for meshc/surfc at zlim(1)
Ben Abbott <bpabbott@mac.com>
parents: 7208
diff changeset
46 zmin = get (ax, "zlim")(1);
7118
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
47
12858
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
48 # don't pass axis handle and/or string arguments to __contour__()
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
49 stop_idx = nargin;
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
50 for i = 2 : nargin
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
51 if (ischar (varargin{i}))
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
52 stop_idx = i - 1;
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
53 break;
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
54 endif
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
55 endfor
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
56
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
57 start_idx = 1;
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
58 if (ishandle (varargin{1}))
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
59 start_idx = 2;
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
60 endif
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
61
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
62 if (stop_idx - start_idx == 1 || stop_idx - start_idx == 3)
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
63 #don't pass a color matrix c to __contour__
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
64 stop_idx -= 1;
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
65 endif
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
66
6ceca9beb331 surfc.m: Don't pass color matrix to contour. Bug #33782
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
67 [c, tmp2] = __contour__ (ax, zmin, varargin{start_idx:stop_idx});
7118
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
68
7170
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents: 7146
diff changeset
69 tmp = [tmp; tmp2];
7118
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
70
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
71 if (nargout > 0)
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
72 h = tmp;
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
73 endif
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents: 7118
diff changeset
74
7118
d32f867e4dda [project @ 2007-11-07 20:44:11 by jwe]
jwe
parents:
diff changeset
75 endfunction
12812
4c93cc41da15 codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
76
4c93cc41da15 codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
77
4c93cc41da15 codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
78 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
79 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
80 %! [~,~,Z] = peaks ();
14223
ba7a26030214 Use Octave spacing convention in %!test blocks of surface plot functions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
81 %! surfc (Z);
ba7a26030214 Use Octave spacing convention in %!test blocks of surface plot functions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
82
ba7a26030214 Use Octave spacing convention in %!test blocks of surface plot functions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
83 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
84 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
85 %! [~,~,Z] = sombrero ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
86 %! [Fx,Fy] = gradient (Z);
14223
ba7a26030214 Use Octave spacing convention in %!test blocks of surface plot functions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
87 %! surfc (Z, Fx+Fy);
12812
4c93cc41da15 codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
88 %! shading interp;
4c93cc41da15 codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
89
4c93cc41da15 codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
90 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
91 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
92 %! [X,Y,Z] = sombrero ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
93 %! [~,Fy] = gradient (Z);
14223
ba7a26030214 Use Octave spacing convention in %!test blocks of surface plot functions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
94 %! surfc (X,Y,Z,Fy);
12812
4c93cc41da15 codesprint: add demo for surf.m and surfc.m
Kai Habel <kai.habel@gmx.de>
parents: 11589
diff changeset
95 %! shading interp;
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14223
diff changeset
96