Mercurial > hg > octave-lyh
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 |
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 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5837 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5837 | 18 |
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 | 31 ## |
32 ## @example | |
33 ## plot3 (@var{x}, @var{y}, @var{z}) | |
34 ## @end example | |
35 ## | |
36 ## @noindent | |
6895 | 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 | 42 ## |
6895 | 43 ## If only two arguments are given, as |
5910 | 44 ## |
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 | 47 ## @end example |
48 ## | |
6895 | 49 ## @noindent |
50 ## the real and imaginary parts of the second argument are used | |
51 ## as the @var{y} and @var{z} coordinates, respectively. | |
5910 | 52 ## |
53 ## If only one argument is given, as | |
54 ## | |
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 | 57 ## @end example |
58 ## | |
6895 | 59 ## @noindent |
5910 | 60 ## the real and imaginary parts of the argument are used as the @var{y} |
61 ## and @var{z} values, and they are plotted versus their index. | |
62 ## | |
6895 | 63 ## Arguments may also be given in groups of three as |
5837 | 64 ## |
65 ## @example | |
6146 | 66 ## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{}) |
5837 | 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 | 69 ## @noindent |
7001 | 70 ## in which each set of three arguments is treated as a separate line or |
5910 | 71 ## set of lines in three dimensions. |
72 ## | |
6895 | 73 ## To plot multiple one- or two-argument groups, separate each group |
74 ## with an empty format string, as | |
5910 | 75 ## |
76 ## @example | |
6895 | 77 ## plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{}) |
5910 | 78 ## @end example |
5837 | 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 | 90 ## |
91 ## @example | |
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 | 96 ## @end group |
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 | 99 ## @end deftypefn |
100 | |
101 ## Author: Paul Kienzle | |
102 ## (modified from __plt__.m) | |
103 | |
6302 | 104 function retval = plot3 (varargin) |
5837 | 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 | 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 | 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 | 285 |
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 | 288 endif |
6004 | 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 | 295 z = imag (y); |
296 y = real (y); | |
297 z_set = 1; | |
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 | 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 | 308 endif |
6459 | 309 endif |
6004 | 310 |
311 if (isvector (x) && isvector (y)) | |
10549 | 312 if (isvector (z)) |
313 x = x(:); | |
314 y = y(:); | |
315 z = z(:); | |
316 elseif (length (x) == rows (z) && length (y) == columns (z)) | |
317 [x, y] = meshgrid (x, y); | |
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 | 320 endif |
6004 | 321 endif |
322 | |
7292 | 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 | 327 endif |
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 | 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 | 336 endif |
337 color = options.color; | |
338 if (isempty (color)) | |
339 color = __next_line_color__ (); | |
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 | 351 endif |
6257 | 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 | 355 endif |
6257 | 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 | 359 endif |
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 | 366 |
6302 | 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 | 369 endif |
370 | |
5837 | 371 endfunction |
7245 | 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 | 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 | 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 |