annotate scripts/plot/plot3.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 b33589ef9213
children 4506eade9f04
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
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
2 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
4 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
8 ## your option) any later version.
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
9 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
14 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
18
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
20 ## @deftypefn {Function File} {} plot3 (@var{args})
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
21 ## Produce three-dimensional plots. Many different combinations of
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
22 ## arguments are possible. The simplest form is
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
23 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
24 ## @example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
25 ## plot3 (@var{x}, @var{y}, @var{z})
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
26 ## @end example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
27 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
28 ## @noindent
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
29 ## in which the arguments are taken to be the vertices of the points to
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
30 ## be plotted in three dimensions. If all arguments are vectors of the
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
31 ## same length, then a single continuous line is drawn. If all arguments
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
32 ## are matrices, then each column of the matrices is treated as a
7001
8b0cfeb06365 [project @ 2007-10-10 18:02:59 by jwe]
jwe
parents: 6895
diff changeset
33 ## separate line. No attempt is made to transpose the arguments to make
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
34 ## the number of rows match.
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
35 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
36 ## If only two arguments are given, as
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
37 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
38 ## @example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
39 ## plot3 (@var{x}, @var{c})
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
40 ## @end example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
41 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
42 ## @noindent
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
43 ## the real and imaginary parts of the second argument are used
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
44 ## as the @var{y} and @var{z} coordinates, respectively.
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
45 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
46 ## If only one argument is given, as
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
47 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
48 ## @example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
49 ## plot3 (@var{c})
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
50 ## @end example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
51 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
52 ## @noindent
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
53 ## the real and imaginary parts of the argument are used as the @var{y}
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
54 ## and @var{z} values, and they are plotted versus their index.
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
55 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
56 ## Arguments may also be given in groups of three as
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
57 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
58 ## @example
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
59 ## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{})
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
60 ## @end example
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
61 ##
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
62 ## @noindent
7001
8b0cfeb06365 [project @ 2007-10-10 18:02:59 by jwe]
jwe
parents: 6895
diff changeset
63 ## in which each set of three arguments is treated as a separate line or
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
64 ## set of lines in three dimensions.
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
65 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
66 ## To plot multiple one- or two-argument groups, separate each group
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
67 ## with an empty format string, as
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
68 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
69 ## @example
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
70 ## plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{})
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
71 ## @end example
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
72 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
73 ## An example of the use of @code{plot3} is
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
74 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
75 ## @example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
76 ## @group
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
77 ## z = [0:0.05:5];
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
78 ## plot3 (cos(2*pi*z), sin(2*pi*z), z, ";helix;");
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
79 ## plot3 (z, exp(2i*pi*z), ";complex sinusoid;");
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
80 ## @end group
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
81 ## @end example
8286
6f2d95255911 fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8257
diff changeset
82 ## @seealso{plot, xlabel, ylabel, zlabel, title, print}
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
83 ## @end deftypefn
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
84
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
85 ## Author: Paul Kienzle
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
86 ## (modified from __plt__.m)
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
87
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
88 function retval = plot3 (varargin)
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
89
6560
03ff4e32c895 [project @ 2007-04-23 15:57:05 by jwe]
jwe
parents: 6459
diff changeset
90 newplot ();
03ff4e32c895 [project @ 2007-04-23 15:57:05 by jwe]
jwe
parents: 6459
diff changeset
91
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
92 x_set = 0;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
93 y_set = 0;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
94 z_set = 0;
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
95 property_set = 0;
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
96 fmt_set = 0;
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
97 properties = {};
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
98 tlgnd = {};
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
99 hlgnd = [];
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
100 idx = 0;
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
101
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
102 ## Gather arguments, decode format, and plot lines.
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
103 arg = 0;
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
104 while (arg++ < nargin)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
105 new = varargin{arg};
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
106 new_cell = varargin(arg);
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
107
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
108 if (property_set)
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
109 properties = [properties, new_cell];
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
110 property_set = 0;
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
111 continue;
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
112 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
113
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
114 if (ischar (new))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
115 if (! z_set)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
116 if (! y_set)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
117 if (! x_set)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
118 error ("plot3: needs x, [ y, [ z ] ]");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
119 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
120 z = imag (x);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
121 y = real (x);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
122 y_set = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
123 z_set = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
124 if (rows(x) > 1)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
125 x = repmat ((1:rows(x))', 1, columns(x));
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
126 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
127 x = 1:columns(x);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
128 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
129 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
130 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
131 z = imag (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
132 y = real (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
133 z_set = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
134 endif
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
135 endif
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
136
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
137 if (! fmt_set)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
138 [options, valid] = __pltopt__ ("plot3", new, false);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
139 if (! valid)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
140 properties = [properties, new_cell];
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
141 property_set = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
142 continue;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
143 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
144 fmt_set = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
145 while (arg < nargin && ischar (varargin{arg+1}))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
146 if (nargin - arg < 2)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
147 error ("plot3: properties must appear followed by a value");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
148 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
149 properties = [properties, varargin(arg+1:arg+2)];
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
150 arg += 2;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
151 endwhile
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
152 endif
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
153 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
154 properties = [properties, new_cell];
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
155 property_set = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
156 continue;
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
157 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
158
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
159 if (isvector (x) && isvector (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
160 if (isvector (z))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
161 x = x(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
162 y = y(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
163 z = z(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
164 elseif (length (x) == rows (z) && length (y) == columns (z))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
165 [x, y] = meshgrid (x, y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
166 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
167 error ("plot3: [length(x), length(y)] must match size(z)");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
168 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
169 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
170
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7245
diff changeset
171 if (! size_equal (x, y, z))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
172 error ("plot3: x, y, and z must have the same shape");
14184
b33589ef9213 plot3.m: Throw error if the input data exceeds two dimensions.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
173 elseif (ndims (x) > 2)
b33589ef9213 plot3.m: Throw error if the input data exceeds two dimensions.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
174 error ("plot3: x, y, and z must not have more than two dimensions");
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
175 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
176
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
177 for i = 1 : columns (x)
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9385
diff changeset
178 linestyle = options.linestyle;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9385
diff changeset
179 marker = options.marker;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
180 if (isempty (marker) && isempty (linestyle))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
181 [linestyle, marker] = __next_line_style__ ();
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
182 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
183 color = options.color;
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
184 if (isempty (color))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
185 color = __next_line_color__ ();
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
186 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
187
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
188 tmp(++idx) = line (x(:, i), y(:, i), z(:, i),
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
189 "color", color, "linestyle", linestyle,
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
190 "marker", marker, properties{:});
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
191 key = options.key;
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
192 if (! isempty (key))
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
193 hlgnd = [hlgnd, tmp(idx)];
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
194 tlgnd = {tlgnd{:}, key};
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
195 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
196 endfor
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
197
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
198 x_set = 0;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
199 y_set = 0;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
200 z_set = 0;
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
201 fmt_set = 0;
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
202 properties = {};
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
203 elseif (! x_set)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
204 x = new;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
205 x_set = 1;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
206 elseif (! y_set)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
207 y = new;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
208 y_set = 1;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
209 elseif (! z_set)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
210 z = new;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
211 z_set = 1;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
212 else
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
213 if (isvector (x) && isvector (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
214 if (isvector (z))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
215 x = x(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
216 y = y(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
217 z = z(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
218 elseif (length (x) == rows (z) && length (y) == columns (z))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
219 [x, y] = meshgrid (x, y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
220 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
221 error ("plot3: [length(x), length(y)] must match size(z)");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
222 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
223 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
224
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7245
diff changeset
225 if (! size_equal (x, y, z))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
226 error ("plot3: x, y, and z must have the same shape");
14184
b33589ef9213 plot3.m: Throw error if the input data exceeds two dimensions.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
227 elseif (ndims (x) > 2)
b33589ef9213 plot3.m: Throw error if the input data exceeds two dimensions.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
228 error ("plot3: x, y, and z must not have more than two dimensions");
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
229 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
230
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
231 options = __default_plot_options__ ();
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
232 for i = 1 : columns (x)
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9385
diff changeset
233 linestyle = options.linestyle;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9385
diff changeset
234 marker = options.marker;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
235 if (isempty (marker) && isempty (linestyle))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
236 [linestyle, marker] = __next_line_style__ ();
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
237 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
238 color = options.color;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
239 if (isempty (color))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
240 color = __next_line_color__ ();
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
241 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
242
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
243 tmp(++idx) = line (x(:, i), y(:, i), z(:, i),
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
244 "color", color, "linestyle", linestyle,
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
245 "marker", marker, properties{:});
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
246 key = options.key;
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
247 if (! isempty (key))
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
248 hlgnd = [hlgnd, tmp(idx)];
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
249 tlgnd = {tlgnd{:}, key};
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
250 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
251 endfor
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
252
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
253 x = new;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
254 y_set = 0;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
255 z_set = 0;
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
256 fmt_set = 0;
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
257 properties = {};
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
258 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
259
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
260 endwhile
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
261
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
262 if (property_set)
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
263 error ("plot3: properties must appear followed by a value");
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
264 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
265
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
266 ## Handle last plot.
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
267
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
268 if (x_set)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
269 if (y_set)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
270 if (! z_set)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
271 z = imag (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
272 y = real (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
273 z_set = 1;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
274 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
275 else
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
276 z = imag (x);
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
277 y = real (x);
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
278 y_set = 1;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
279 z_set = 1;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
280 if (rows (x) > 1)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
281 x = repmat ((1:rows (x))', 1, columns(x));
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
282 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
283 x = 1:columns(x);
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
284 endif
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
285 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
286
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
287 if (isvector (x) && isvector (y))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
288 if (isvector (z))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
289 x = x(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
290 y = y(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
291 z = z(:);
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
292 elseif (length (x) == rows (z) && length (y) == columns (z))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
293 [x, y] = meshgrid (x, y);
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
294 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
295 error ("plot3: [length(x), length(y)] must match size(z)");
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
296 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
297 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
298
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7245
diff changeset
299 if (! size_equal (x, y, z))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
300 error ("plot3: x, y, and z must have the same shape");
14184
b33589ef9213 plot3.m: Throw error if the input data exceeds two dimensions.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
301 elseif (ndims (x) > 2)
b33589ef9213 plot3.m: Throw error if the input data exceeds two dimensions.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
302 error ("plot3: x, y, and z must not have more than two dimensions");
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
303 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
304
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
305 options = __default_plot_options__ ();
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
306
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
307 for i = 1 : columns (x)
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9385
diff changeset
308 linestyle = options.linestyle;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9385
diff changeset
309 marker = options.marker;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9385
diff changeset
310 if (isempty (marker) && isempty (linestyle))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
311 [linestyle, marker] = __next_line_style__ ();
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 9385
diff changeset
312 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
313 color = options.color;
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
314 if (isempty (color))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
315 color = __next_line_color__ ();
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
316 endif
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
317
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
318 tmp(++idx) = line (x(:, i), y(:, i), z(:, i),
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
319 "color", color, "linestyle", linestyle,
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
320 "marker", marker, properties{:});
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
321 key = options.key;
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
322 if (! isempty (key))
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
323 hlgnd = [hlgnd, tmp(idx)];
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
324 tlgnd = {tlgnd{:}, key};
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
325 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
326 endfor
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
327 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
328
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
329 if (!isempty (hlgnd))
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
330 legend (gca(), hlgnd, tlgnd);
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
331 endif
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
332
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
333 set (gca (), "view", [-37.5, 30]);
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
334
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
335 if (nargout > 0 && idx > 0)
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
336 retval = tmp;
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
337 endif
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
338
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
339 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
340
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
341
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
342 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
343 %! clf;
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
344 %! z = [0:0.05:5];
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
345 %! plot3 (cos(2*pi*z), sin(2*pi*z), z, ";helix;");
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
346 %! plot3 (z, exp(2i*pi*z), ";complex sinusoid;");
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
347