annotate scripts/plot/plot3.m @ 17130:26589abbc78d

Don't pass axis handle unnecessarily from high level to low level plot functions. * scripts/plot/comet.m, scripts/plot/comet3.m, scripts/plot/compass.m, scripts/plot/contour.m, scripts/plot/contourf.m, scripts/plot/cylinder.m, scripts/plot/ellipsoid.m, scripts/plot/errorbar.m, scripts/plot/feather.m, scripts/plot/mesh.m, scripts/plot/meshc.m, scripts/plot/meshz.m, scripts/plot/pcolor.m, scripts/plot/plot3.m, scripts/plot/rectangle.m, scripts/plot/rose.m, scripts/plot/scatter3.m, scripts/plot/semilogxerr.m, scripts/plot/semilogy.m, scripts/plot/semilogyerr.m, scripts/plot/slice.m, scripts/plot/sphere.m, scripts/plot/stairs.m, scripts/plot/surf.m, scripts/plot/surfc.m, scripts/plot/surfnorm.m, scripts/plot/trimesh.m, scripts/plot/trisurf.m: Don't pass hax to lower level functions after newplot() has been called.
author Rik <rik@octave.org>
date Wed, 31 Jul 2013 18:42:17 -0700
parents eaab03308c0b
children df4c4b7708a4
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 -*-
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
20 ## @deftypefn {Function File} {} plot3 (@var{x}, @var{y}, @var{z})
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17055
diff changeset
21 ## @deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{prop}, @var{value}, @dots{})
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
22 ## @deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{fmt})
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
23 ## @deftypefnx {Function File} {} plot3 (@var{x}, @var{cplx})
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
24 ## @deftypefnx {Function File} {} plot3 (@var{cplx})
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
25 ## @deftypefnx {Function File} {} plot3 (@var{hax}, @dots{})
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
26 ## @deftypefnx {Function File} {@var{h} =} plot3 (@dots{})
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17055
diff changeset
27 ## Produce 3-D plots.
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
28 ##
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
29 ## Many different combinations of arguments are possible. The simplest
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
30 ## form is
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
31 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
32 ## @example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
33 ## plot3 (@var{x}, @var{y}, @var{z})
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
34 ## @end example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
35 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
36 ## @noindent
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
37 ## 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
38 ## 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
39 ## same length, then a single continuous line is drawn. If all arguments
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
40 ## are matrices, then each column of is treated as a separate line. No attempt
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
41 ## is made to transpose the arguments to make the number of rows match.
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
42 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
43 ## If only two arguments are given, as
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
44 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
45 ## @example
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
46 ## plot3 (@var{x}, @var{cplx})
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
47 ## @end example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
48 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
49 ## @noindent
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
50 ## 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
51 ## 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
52 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
53 ## If only one argument is given, as
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
54 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
55 ## @example
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
56 ## plot3 (@var{cplx})
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
57 ## @end example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
58 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
59 ## @noindent
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
60 ## 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
61 ## 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
62 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
63 ## 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
64 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
65 ## @example
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
66 ## 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
67 ## @end example
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
68 ##
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
69 ## @noindent
7001
8b0cfeb06365 [project @ 2007-10-10 18:02:59 by jwe]
jwe
parents: 6895
diff changeset
70 ## 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
71 ## set of lines in three dimensions.
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
72 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
73 ## 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
74 ## with an empty format string, as
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
75 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
76 ## @example
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6560
diff changeset
77 ## plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{})
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
78 ## @end example
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
79 ##
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
80 ## Multiple property-value pairs may be specified which will affect the line
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
81 ## objects drawn by @code{plot3}. If the @var{fmt} argument is supplied it
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
82 ## will format the line objects in the same manner as @code{plot}.
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
83 ##
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17055
diff changeset
84 ## If the first argument @var{hax} is an axes handle, then plot into this axis,
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17055
diff changeset
85 ## rather than the current axes returned by @code{gca}.
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
86 ##
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
87 ## The optional return value @var{h} is a graphics handle to the created plot.
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
88 ##
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17055
diff changeset
89 ## Example:
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
90 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
91 ## @example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
92 ## @group
14327
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
93 ## z = [0:0.05:5];
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
94 ## plot3 (cos (2*pi*z), sin (2*pi*z), z, ";helix;");
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
95 ## plot3 (z, exp (2i*pi*z), ";complex sinusoid;");
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
96 ## @end group
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
97 ## @end example
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
98 ## @seealso{ezplot3, plot}
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
99 ## @end deftypefn
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
100
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
101 ## Author: Paul Kienzle
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
102 ## (modified from __plt__.m)
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
103
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
104 function retval = plot3 (varargin)
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
105
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
106 [hax, varargin, nargs] = __plt_get_axis_arg__ ("plot3", varargin{:});
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
107
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
108 if (nargs < 1)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
109 print_usage ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
110 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
111
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
112 oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
113 unwind_protect
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
114 hax = newplot (hax);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
115
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
116 x_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
117 y_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
118 z_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
119 property_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
120 fmt_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
121 properties = {};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
122 tlgnd = {};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
123 hlgnd = [];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
124 idx = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
125
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
126 ## Gather arguments, decode format, and plot lines.
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
127 arg = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
128 while (arg++ < nargs)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
129 new = varargin{arg};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
130 new_cell = varargin(arg);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
131
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
132 if (property_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
133 properties = [properties, new_cell];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
134 property_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
135 continue;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
136 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
137
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
138 if (ischar (new))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
139 if (! z_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
140 if (! y_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
141 if (! x_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
142 error ("plot3: needs X, [ Y, [ Z ] ]");
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
143 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
144 y = real (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
145 z = imag (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
146 y_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
147 z_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
148 if (rows (x) > 1)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
149 x = repmat ((1:rows (x))', 1, columns (x));
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
150 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
151 x = 1:columns (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
152 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
153 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
154 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
155 z = imag (y);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
156 y = real (y);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
157 z_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
158 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
159 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
160
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
161 if (! fmt_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
162 [options, valid] = __pltopt__ ("plot3", new, false);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
163 if (! valid)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
164 properties = [properties, new_cell];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
165 property_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
166 continue;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
167 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
168 fmt_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
169 while (arg < nargs && ischar (varargin{arg+1}))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
170 if (nargs - arg < 2)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
171 error ("plot3: properties must appear followed by a value");
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
172 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
173 properties = [properties, varargin(arg+1:arg+2)];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
174 arg += 2;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
175 endwhile
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
176 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
177 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
178 properties = [properties, new_cell];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
179 property_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
180 continue;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
181 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
182
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
183 if (isvector (x) && isvector (y))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
184 if (isvector (z))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
185 x = x(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
186 y = y(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
187 z = z(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
188 elseif (length (x) == rows (z) && length (y) == columns (z))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
189 [x, y] = meshgrid (x, y);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
190 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
191 error ("plot3: [length(X), length(Y)] must match size (Z)");
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
192 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
193 endif
6560
03ff4e32c895 [project @ 2007-04-23 15:57:05 by jwe]
jwe
parents: 6459
diff changeset
194
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
195 if (! size_equal (x, y, z))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
196 error ("plot3: X, Y, and Z must have the same shape");
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
197 elseif (ndims (x) > 2)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
198 error ("plot3: X, Y, and Z must not have more than two dimensions");
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
199 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
200
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
201 for i = 1 : columns (x)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
202 linestyle = options.linestyle;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
203 marker = options.marker;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
204 if (isempty (marker) && isempty (linestyle))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
205 [linestyle, marker] = __next_line_style__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
206 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
207 color = options.color;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
208 if (isempty (color))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
209 color = __next_line_color__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
210 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
211
17130
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17126
diff changeset
212 htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
213 "color", color, "linestyle", linestyle,
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
214 "marker", marker, properties{:});
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
215 key = options.key;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
216 if (! isempty (key))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
217 hlgnd = [hlgnd, htmp(idx)];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
218 tlgnd = {tlgnd{:}, key};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
219 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
220 endfor
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
221
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
222 x_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
223 y_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
224 z_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
225 fmt_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
226 properties = {};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
227 elseif (! x_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
228 x = new;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
229 x_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
230 elseif (! y_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
231 y = new;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
232 y_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
233 elseif (! z_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
234 z = new;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
235 z_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
236 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
237 if (isvector (x) && isvector (y))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
238 if (isvector (z))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
239 x = x(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
240 y = y(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
241 z = z(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
242 elseif (length (x) == rows (z) && length (y) == columns (z))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
243 [x, y] = meshgrid (x, y);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
244 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
245 error ("plot3: [length(X), length(Y)] must match size (Z)");
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
246 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
247 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
248
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
249 if (! size_equal (x, y, z))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
250 error ("plot3: X, Y, and Z must have the same shape");
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
251 elseif (ndims (x) > 2)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
252 error ("plot3: X, Y, and Z must not have more than two dimensions");
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
253 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
254
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
255 options = __default_plot_options__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
256 for i = 1 : columns (x)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
257 linestyle = options.linestyle;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
258 marker = options.marker;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
259 if (isempty (marker) && isempty (linestyle))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
260 [linestyle, marker] = __next_line_style__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
261 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
262 color = options.color;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
263 if (isempty (color))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
264 color = __next_line_color__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
265 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
266
17130
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17126
diff changeset
267 htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
268 "color", color, "linestyle", linestyle,
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
269 "marker", marker, properties{:});
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
270 key = options.key;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
271 if (! isempty (key))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
272 hlgnd = [hlgnd, htmp(idx)];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
273 tlgnd = {tlgnd{:}, key};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
274 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
275 endfor
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
276
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
277 x = new;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
278 y_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
279 z_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
280 fmt_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
281 properties = {};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
282 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
283
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
284 endwhile
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
285
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
286 if (property_set)
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
287 error ("plot3: properties must appear followed by a value");
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
288 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
289
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
290 ## Handle last plot.
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
291
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
292 if (x_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
293 if (y_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
294 if (! z_set)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
295 z = imag (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
296 y = real (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
297 z_set = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
298 endif
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
299 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
300 y = real (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
301 z = imag (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
302 y_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
303 z_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
304 if (rows (x) > 1)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
305 x = repmat ((1:rows (x))', 1, columns (x));
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
306 else
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
307 x = 1:columns (x);
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
308 endif
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
309 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
310
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
311 if (isvector (x) && isvector (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
312 if (isvector (z))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
313 x = x(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
314 y = y(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
315 z = z(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
316 elseif (length (x) == rows (z) && length (y) == columns (z))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
317 [x, y] = meshgrid (x, y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
318 else
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
319 error ("plot3: [length(X), length(Y)] must match size (Z)");
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
320 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
321 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
322
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7245
diff changeset
323 if (! size_equal (x, y, z))
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
324 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
325 elseif (ndims (x) > 2)
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
326 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
327 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
328
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
329 options = __default_plot_options__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
330
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
331 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
332 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
333 marker = options.marker;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
334 if (isempty (marker) && isempty (linestyle))
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
335 [linestyle, marker] = __next_line_style__ ();
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
336 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
337 color = options.color;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
338 if (isempty (color))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
339 color = __next_line_color__ ();
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
340 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
341
17130
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17126
diff changeset
342 htmp(++idx) = line (x(:, i), y(:, i), z(:, i),
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
343 "color", color, "linestyle", linestyle,
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
344 "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
345 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
346 if (! isempty (key))
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
347 hlgnd = [hlgnd, htmp(idx)];
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
348 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
349 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
350 endfor
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
351 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
352
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
353 if (! isempty (hlgnd))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
354 legend (hax, hlgnd, tlgnd);
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
355 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
356
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
357 if (! ishold ())
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
358 set (hax, "view", [-37.5, 30]);
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
359 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
360
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
361 unwind_protect_cleanup
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
362 if (! isempty (oldfig))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
363 set (0, "currentfigure", oldfig);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
364 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
365 end_unwind_protect
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
366
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
367 if (nargout > 0 && idx > 0)
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
368 retval = htmp;
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
369 endif
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
370
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
371 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
372
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
373
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
374 %!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
375 %! clf;
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
376 %! z = [0:0.05:5];
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14335
diff changeset
377 %! plot3 (cos (2*pi*z), sin (2*pi*z), z, ';helix;');
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
378
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
379 %!demo
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
380 %! clf;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
381 %! z = [0:0.05:5];
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14335
diff changeset
382 %! 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
383