Mercurial > hg > octave-lyh
annotate scripts/plot/ribbon.m @ 13141:e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
* bicg.m, gmres.m, pkg.m: Untabify and remove trailing whitespace.
* libcruft/Makefile.am, libcruft/blas-xtra/cdotc3.f,
libcruft/blas-xtra/cmatm3.f, libcruft/blas-xtra/ddot3.f,
libcruft/blas-xtra/dmatm3.f, libcruft/blas-xtra/sdot3.f,
libcruft/blas-xtra/smatm3.f, libcruft/blas-xtra/zdotc3.f,
libcruft/blas-xtra/zmatm3.f, libcruft/lapack-xtra/crsf2csf.f,
libcruft/lapack-xtra/zrsf2csf.f, liboctave/Array.cc,
liboctave/DASPK-opts.in, liboctave/DASRT-opts.in,
liboctave/DASSL-opts.in, liboctave/LSODE-opts.in,
liboctave/Makefile.a,mliboctave/Quad-opts.in,
liboctave/Sparse-perm-op-defs.h,
scripts/Makefile.a,mscripts/deprecated/glpkmex.m,
scripts/general/blkdiag.m, scripts/general/interp1.m,
scripts/general/profshow.m, scripts/general/quadl.m,
scripts/general/triplequad.m, scripts/help/__makeinfo__.m,
scripts/io/strread.m, scripts/io/textread.m, scripts/io/textscan.m,
scripts/linear-algebra/rank.m, scripts/miscellaneous/gzip.m,
scripts/miscellaneous/private/__xzip__.m,
scripts/miscellaneous/tempdir.m, scripts/miscellaneous/unpack.m,
scripts/pkg/pkg.m, scripts/plot/allchild.m, scripts/plot/ancestor.m,
scripts/plot/cla.m, scripts/plot/clf.m, scripts/plot/findall.m,
scripts/plot/findobj.m, scripts/plot/gca.m, scripts/plot/gcf.m,
scripts/plot/hggroup.m, scripts/plot/isfigure.m,
scripts/plot/ishghandle.m, scripts/plot/legend.m,
scripts/plot/line.m, scripts/plot/loglog.m, scripts/plot/patch.m,
scripts/plot/print.m, scripts/plot/private/__quiver__.m,
scripts/plot/private/__scatter__.m, scripts/plot/rectangle.m,
scripts/plot/semilogx.m, scripts/plot/semilogy.m,
scripts/plot/surface.m, scripts/plot/text.m, scripts/plot/title.m,
scripts/plot/trisurf.m, scripts/plot/view.m, scripts/plot/whitebg.m,
scripts/plot/xlabel.m, scripts/plot/xlim.m, scripts/plot/ylabel.m,
scripts/plot/ylim.m, scripts/plot/zlabel.m, scripts/plot/zlim.m,
scripts/polynomial/mkpp.m, scripts/polynomial/polygcd.m,
scripts/polynomial/ppint.m, scripts/polynomial/ppjumps.m,
scripts/polynomial/ppval.m, scripts/set/setxor.m,
scripts/sparse/bicgstab.m, scripts/sparse/cgs.m,
scripts/sparse/spconvert.m, scripts/specfun/nthroot.m,
scripts/strings/strmatch.m, scripts/strings/untabify.m,
scripts/testfun/demo.m, scripts/testfun/example.m,
src/DLD-FUNCTIONS/filter.cc, src/DLD-FUNCTIONS/mgorth.cc,
src/DLD-FUNCTIONS/quadcc.cc, src/DLD-FUNCTIONS/str2double.cc,
src/Makefile.a,msrc/gl-render.cc, src/gl2ps-renderer.cc,
src/graphics.cc, src/octave-config.cc.in, src/octave-config.in,
src/ov-class.h, src/ov-fcn.h, src/profiler.cc, src/profiler.h,
src/pt-binop.cc, src/pt-unop.cc, src/symtab.cc, src/txt-eng-ft.cc:
Remove trailing whitespace.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 15 Sep 2011 12:51:10 -0400 |
parents | fd0a3ac60b0e |
children | 5f0bb45e615c |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2007-2011 Kai Habel |
7163 | 2 ## |
7164 | 3 ## This file is part of Octave. |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
7163 | 6 ## under the terms of the GNU General Public License as published by |
7164 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
7163 | 9 ## |
7164 | 10 ## Octave is distributed in the hope that it will be useful, but |
7163 | 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 | |
7164 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
7163 | 18 |
19 ## -*- texinfo -*- | |
9143
74d5c1a4ca96
Eliminate 'unbalanced parentheses in @def...' error during texi2pdf.
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
20 ## @deftypefn {Function File} {} ribbon (@var{x}, @var{y}, @var{width}) |
74d5c1a4ca96
Eliminate 'unbalanced parentheses in @def...' error during texi2pdf.
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
21 ## @deftypefnx {Function File} {} ribbon (@var{y}) |
74d5c1a4ca96
Eliminate 'unbalanced parentheses in @def...' error during texi2pdf.
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
22 ## @deftypefnx {Function File} {@var{h} =} ribbon (@dots{}) |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
23 ## Plot a ribbon plot for the columns of @var{y} vs. @var{x}. The |
7164 | 24 ## optional parameter @var{width} specifies the width of a single ribbon |
25 ## (default is 0.75). If @var{x} is omitted, a vector containing the | |
26 ## row numbers is assumed (1:rows(Y)). If requested, return a vector | |
27 ## @var{h} of the handles to the surface objects. | |
28 ## @seealso{gca, colorbar} | |
7163 | 29 ## @end deftypefn |
30 | |
31 ## Author: Kai Habel <kai.habel at gmx.de> | |
32 | |
7166 | 33 function h = ribbon (x, y, width) |
7163 | 34 |
35 newplot (); | |
36 | |
37 if (nargin == 1) | |
7166 | 38 y = x; |
39 if (isvector (y)) | |
40 y = y(:); | |
7163 | 41 endif |
7166 | 42 [nr, nc] = size (y); |
43 x = repmat ((1:nr)', 1, nc); | |
44 width = 0.75; | |
7163 | 45 elseif (nargin == 2) |
7166 | 46 width = 0.75; |
7164 | 47 elseif (nargin != 3) |
48 print_usage (); | |
8610
85c9906abfd1
use endif and endfor instead of end
John W. Eaton <jwe@octave.org>
parents:
7650
diff
changeset
|
49 endif |
7163 | 50 |
7166 | 51 if (isvector (x) && isvector (y)) |
52 if (length (x) != length (y)) | |
8664 | 53 error ("ribbon: in case of vectors, X and Y must have same length"); |
7163 | 54 else |
7166 | 55 [x, y] = meshgrid (x, y); |
7163 | 56 endif |
57 else | |
7292 | 58 if (! size_equal(x, y)) |
8664 | 59 error ("ribbon: in case of matrices, X and Y must have same size"); |
7163 | 60 endif |
61 endif | |
62 | |
7166 | 63 [nr, nc] = size (y); |
7164 | 64 tmp = zeros (1, nc); |
7163 | 65 |
66 for c = nc:-1:1 | |
7166 | 67 zz = [y(:,c), y(:,c)]; |
68 yy = x(:,c); | |
69 xx = [c - width / 2, c + width / 2]; | |
70 [xx, yy] = meshgrid (xx, yy); | |
71 cc = ones (size (zz)) * c; | |
72 tmp(c) = surface (xx, yy, zz, cc); | |
7163 | 73 endfor |
74 | |
75 ax = get (tmp(c), "parent"); | |
76 | |
7164 | 77 if (! ishold ()) |
78 set (ax, "view", [-37.5, 30], "box", "off", "xgrid", "on", | |
10549 | 79 "ygrid", "on", "zgrid", "on"); |
7163 | 80 endif |
81 | |
82 if (nargout > 0) | |
83 h = tmp; | |
84 endif | |
7164 | 85 |
86 endfunction | |
7269 | 87 |
88 %!demo | |
89 %! [x, y, z] = sombrero (); | |
90 %! [x, y] = meshgrid (x, y); | |
91 %! ribbon (y, z); |