annotate scripts/plot/draw/plot3.m @ 19114:9a5e03801d23

Update some plot %!demos so that they run under Matlab. * datetick.m: Explicitly name 'x' axis in call to datetick. * mesh.m: Use try/catch around block checking __graphics_toolkit__ which is an Octave-only figure property. * patch.m: Call patch with X,Y,C rather than X,Y,PROP,VAL which is not supported by Matlab. * ezplot3: Use explicit call to legend, rather than ';legend;' in ezplot3 call which is Octave-only syntax. * rose.m: Add a demo that Matlab can run. Matlab won't run the second demo which uses Octave-only syntax. * copyobj.m: Don't use errorbar plot style argument which is Octave-only syntax.
author Rik <rik@octave.org>
date Mon, 14 Jul 2014 21:40:28 -0700
parents d63878346099
children 4197fc428c7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17572
diff changeset
1 ## Copyright (C) 1996-2013 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})
17122
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{})
17122
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 ##
17122
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 ##
17122
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
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
112 oldfig = [];
17301
68bcac3c043a Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents: 17211
diff changeset
113 if (! isempty (hax))
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
114 oldfig = get (0, "currentfigure");
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
115 endif
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
116 unwind_protect
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
117 hax = newplot (hax);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
118
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
119 x_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
120 y_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
121 z_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
122 property_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
123 fmt_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
124 properties = {};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
125 tlgnd = {};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
126 hlgnd = [];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
127 idx = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
128
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
129 ## 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
130 arg = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
131 while (arg++ < nargs)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
132 new = varargin{arg};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
133 new_cell = varargin(arg);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
134
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
135 if (property_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
136 properties = [properties, new_cell];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
137 property_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
138 continue;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
139 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
140
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
141 if (ischar (new))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
142 if (! z_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
143 if (! y_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
144 if (! x_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
145 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
146 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
147 y = real (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
148 z = imag (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
149 y_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
150 z_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
151 if (rows (x) > 1)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
152 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
153 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
154 x = 1:columns (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
155 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
156 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
157 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
158 z = imag (y);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
159 y = real (y);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
160 z_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
161 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
162 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
163
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
164 if (! fmt_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
165 [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
166 if (! valid)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
167 properties = [properties, new_cell];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
168 property_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
169 continue;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
170 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
171 fmt_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
172 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
173 if (nargs - arg < 2)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
174 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
175 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
176 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
177 arg += 2;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
178 endwhile
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
179 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
180 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
181 properties = [properties, new_cell];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
182 property_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
183 continue;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
184 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
185
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
186 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
187 if (isvector (z))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
188 x = x(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
189 y = y(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
190 z = z(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
191 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
192 [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
193 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
194 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
195 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
196 endif
6560
03ff4e32c895 [project @ 2007-04-23 15:57:05 by jwe]
jwe
parents: 6459
diff changeset
197
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
198 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
199 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
200 elseif (ndims (x) > 2)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
201 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
202 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
203
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
204 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
205 linestyle = options.linestyle;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
206 marker = options.marker;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
207 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
208 [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
209 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
210 color = options.color;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
211 if (isempty (color))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
212 color = __next_line_color__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
213 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
214
17126
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
215 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
216 "color", color, "linestyle", linestyle,
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
217 "marker", marker, properties{:});
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
218 key = options.key;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
219 if (! isempty (key))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
220 hlgnd = [hlgnd, htmp(idx)];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
221 tlgnd = {tlgnd{:}, key};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
222 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
223 endfor
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
224
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
225 x_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
226 y_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
227 z_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
228 fmt_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
229 properties = {};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
230 elseif (! x_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
231 x = new;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
232 x_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
233 elseif (! y_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
234 y = new;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
235 y_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
236 elseif (! z_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
237 z = new;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
238 z_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
239 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
240 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
241 if (isvector (z))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
242 x = x(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
243 y = y(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
244 z = z(:);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
245 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
246 [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
247 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
248 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
249 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
250 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
251
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
252 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
253 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
254 elseif (ndims (x) > 2)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
255 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
256 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
257
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
258 options = __default_plot_options__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
259 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
260 linestyle = options.linestyle;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
261 marker = options.marker;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
262 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
263 [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
264 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
265 color = options.color;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
266 if (isempty (color))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
267 color = __next_line_color__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
268 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
269
17126
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
270 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
271 "color", color, "linestyle", linestyle,
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
272 "marker", marker, properties{:});
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
273 key = options.key;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
274 if (! isempty (key))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
275 hlgnd = [hlgnd, htmp(idx)];
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
276 tlgnd = {tlgnd{:}, key};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
277 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
278 endfor
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
279
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
280 x = new;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
281 y_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
282 z_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
283 fmt_set = 0;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
284 properties = {};
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
285 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
286
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
287 endwhile
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
288
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
289 if (property_set)
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
290 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
291 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
292
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
293 ## Handle last plot.
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
294
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
295 if (x_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
296 if (y_set)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
297 if (! z_set)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
298 z = imag (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
299 y = real (y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
300 z_set = 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
301 endif
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
302 else
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
303 y = real (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
304 z = imag (x);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
305 y_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
306 z_set = 1;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
307 if (rows (x) > 1)
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
308 x = repmat ((1:rows (x))', 1, columns (x));
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
309 else
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
310 x = 1:columns (x);
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
311 endif
6459
5dc550e1f419 [project @ 2007-03-26 18:11:58 by jwe]
jwe
parents: 6448
diff changeset
312 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
313
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
314 if (isvector (x) && isvector (y))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
315 if (isvector (z))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
316 x = x(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
317 y = y(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
318 z = z(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
319 elseif (length (x) == rows (z) && length (y) == columns (z))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
320 [x, y] = meshgrid (x, y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
321 else
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
322 error ("plot3: [length(X), length(Y)] must match size (Z)");
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
323 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
324 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
325
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7245
diff changeset
326 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
327 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
328 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
329 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
330 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
331
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
332 options = __default_plot_options__ ();
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
333
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
334 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
335 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
336 marker = options.marker;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
337 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
338 [linestyle, marker] = __next_line_style__ ();
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
339 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
340 color = options.color;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
341 if (isempty (color))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
342 color = __next_line_color__ ();
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10135
diff changeset
343 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
344
17126
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
345 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
346 "color", color, "linestyle", linestyle,
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
347 "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
348 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
349 if (! isempty (key))
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
350 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
351 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
352 endif
8078
4665276ff7f6 correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents: 8075
diff changeset
353 endfor
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
354 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
355
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
356 if (! isempty (hlgnd))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
357 legend (hax, hlgnd, tlgnd);
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
358 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
359
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
360 if (! ishold ())
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
361 set (hax, "view", [-37.5, 30]);
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
362 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6172
diff changeset
363
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
364 unwind_protect_cleanup
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
365 if (! isempty (oldfig))
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
366 set (0, "currentfigure", oldfig);
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
367 endif
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
368 end_unwind_protect
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
369
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
370 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
371 retval = htmp;
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
372 endif
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6267
diff changeset
373
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
374 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
375
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
376
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
377 %!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
378 %! clf;
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
379 %! z = [0:0.05:5];
19114
9a5e03801d23 Update some plot %!demos so that they run under Matlab.
Rik <rik@octave.org>
parents: 17744
diff changeset
380 %! plot3 (cos (2*pi*z), sin (2*pi*z), z)
9a5e03801d23 Update some plot %!demos so that they run under Matlab.
Rik <rik@octave.org>
parents: 17744
diff changeset
381 %! legend ('helix');
17190
df4c4b7708a4 Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents: 17126
diff changeset
382 %! title ('plot3() of a helix');
17055
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
383
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
384 %!demo
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
385 %! clf;
9fe930c5abbf plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents: 14868
diff changeset
386 %! z = [0:0.05:5];
19114
9a5e03801d23 Update some plot %!demos so that they run under Matlab.
Rik <rik@octave.org>
parents: 17744
diff changeset
387 %! plot3 (z, exp (2i*pi*z));
9a5e03801d23 Update some plot %!demos so that they run under Matlab.
Rik <rik@octave.org>
parents: 17744
diff changeset
388 %! legend ('complex sinusoid');
17190
df4c4b7708a4 Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents: 17126
diff changeset
389 %! title ('plot3() with complex input');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14184
diff changeset
390