Mercurial > octave
annotate scripts/plot/draw/plot3.m @ 29358:0a5b15007766 stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2021 09:52:15 -0500 |
parents | 9342688e86b4 |
children | 796f54d4ddbf |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
28733
diff
changeset
|
3 ## Copyright (C) 1996-2021 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
5837 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
5837 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
5837 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
5837 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
5837 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
27 ## @deftypefn {} {} plot3 (@var{x}, @var{y}, @var{z}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
28 ## @deftypefnx {} {} plot3 (@var{x}, @var{y}, @var{z}, @var{prop}, @var{value}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
29 ## @deftypefnx {} {} plot3 (@var{x}, @var{y}, @var{z}, @var{fmt}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
30 ## @deftypefnx {} {} plot3 (@var{x}, @var{cplx}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
31 ## @deftypefnx {} {} plot3 (@var{cplx}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
32 ## @deftypefnx {} {} plot3 (@var{hax}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
33 ## @deftypefnx {} {@var{h} =} plot3 (@dots{}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17055
diff
changeset
|
34 ## 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
|
35 ## |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
36 ## 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
|
37 ## form is |
5837 | 38 ## |
39 ## @example | |
40 ## plot3 (@var{x}, @var{y}, @var{z}) | |
41 ## @end example | |
42 ## | |
43 ## @noindent | |
6895 | 44 ## 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
|
45 ## 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
|
46 ## 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
|
47 ## 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
|
48 ## is made to transpose the arguments to make the number of rows match. |
5837 | 49 ## |
6895 | 50 ## If only two arguments are given, as |
5910 | 51 ## |
52 ## @example | |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
53 ## plot3 (@var{x}, @var{cplx}) |
5910 | 54 ## @end example |
55 ## | |
6895 | 56 ## @noindent |
57 ## the real and imaginary parts of the second argument are used | |
58 ## as the @var{y} and @var{z} coordinates, respectively. | |
5910 | 59 ## |
60 ## If only one argument is given, as | |
61 ## | |
62 ## @example | |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
63 ## plot3 (@var{cplx}) |
5910 | 64 ## @end example |
65 ## | |
6895 | 66 ## @noindent |
5910 | 67 ## the real and imaginary parts of the argument are used as the @var{y} |
68 ## and @var{z} values, and they are plotted versus their index. | |
69 ## | |
6895 | 70 ## Arguments may also be given in groups of three as |
5837 | 71 ## |
72 ## @example | |
6146 | 73 ## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{}) |
5837 | 74 ## @end example |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
75 ## |
5837 | 76 ## @noindent |
7001 | 77 ## in which each set of three arguments is treated as a separate line or |
5910 | 78 ## set of lines in three dimensions. |
79 ## | |
6895 | 80 ## To plot multiple one- or two-argument groups, separate each group |
81 ## with an empty format string, as | |
5910 | 82 ## |
83 ## @example | |
6895 | 84 ## plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{}) |
5910 | 85 ## @end example |
5837 | 86 ## |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
87 ## 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
|
88 ## 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
|
89 ## will format the line objects in the same manner as @code{plot}. |
28733
9342688e86b4
Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27985
diff
changeset
|
90 ## The full list of properties is documented at |
9342688e86b4
Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27985
diff
changeset
|
91 ## @ref{Line Properties}. |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
92 ## |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
93 ## If the first argument @var{hax} is an axes handle, then plot into this axes, |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17055
diff
changeset
|
94 ## 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
|
95 ## |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
96 ## 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
|
97 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17055
diff
changeset
|
98 ## Example: |
5837 | 99 ## |
100 ## @example | |
101 ## @group | |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14184
diff
changeset
|
102 ## 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
|
103 ## 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
|
104 ## plot3 (z, exp (2i*pi*z), ";complex sinusoid;"); |
5837 | 105 ## @end group |
106 ## @end example | |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
107 ## @seealso{ezplot3, plot} |
5837 | 108 ## @end deftypefn |
109 | |
24818
d55e100aebc9
plot3.m: Return an empty matrix when no plot is created (bug #53215).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
110 function h = plot3 (varargin) |
5837 | 111 |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
112 [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
|
113 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
114 if (nargs < 1) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
115 print_usage (); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
116 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
117 |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
118 oldfig = []; |
17301
68bcac3c043a
Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
119 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
|
120 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
|
121 endif |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
122 unwind_protect |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
123 hax = newplot (hax); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
124 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
125 x_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
126 y_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
127 z_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
128 property_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
129 fmt_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
130 properties = {}; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
131 tlgnd = {}; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
132 hlgnd = []; |
24838
08a591a59a95
plot3.m: Fix bug introduced in cset d55e100aebc9.
Rik <rik@octave.org>
parents:
24818
diff
changeset
|
133 htmp = []; |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
134 idx = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
135 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
136 ## 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
|
137 arg = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
138 while (arg++ < nargs) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
139 new = varargin{arg}; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
140 new_cell = varargin(arg); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
141 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
142 if (property_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
143 properties = [properties, new_cell]; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
144 property_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
145 continue; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
146 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
147 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
148 if (ischar (new)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
149 if (! z_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
150 if (! y_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
151 if (! x_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
152 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
|
153 else |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
154 y = real (x); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
155 z = imag (x); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
156 y_set = 1; |
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 if (rows (x) > 1) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
159 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
|
160 else |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
161 x = 1:columns (x); |
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 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
164 else |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
165 z = imag (y); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
166 y = real (y); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
167 z_set = 1; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
168 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
169 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
170 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
171 if (! fmt_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
172 [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
|
173 if (! valid) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
174 properties = [properties, new_cell]; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
175 property_set = 1; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
176 continue; |
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 fmt_set = 1; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
179 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
|
180 if (nargs - arg < 2) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
181 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
|
182 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
183 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
|
184 arg += 2; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
185 endwhile |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
186 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
187 else |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
188 properties = [properties, new_cell]; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
189 property_set = 1; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
190 continue; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
191 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
192 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
193 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
|
194 if (isvector (z)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
195 x = x(:); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
196 y = y(:); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
197 z = z(:); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
198 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
|
199 [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
|
200 else |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
201 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
|
202 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
203 endif |
6560 | 204 |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
205 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
|
206 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
|
207 elseif (ndims (x) > 2) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
208 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
|
209 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
210 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
211 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
|
212 linestyle = options.linestyle; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
213 marker = options.marker; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
214 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
|
215 [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
|
216 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
217 color = options.color; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
218 if (isempty (color)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
219 color = __next_line_color__ (); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
220 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
221 |
26217
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
222 htmp(++idx) = __go_line__ (hax, "xdata", x(:, i), "ydata", y(:, i), |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
223 "zdata", z(:, i), |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
224 "color", color, "linestyle", linestyle, |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
225 "marker", marker, properties{:}); |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
226 key = options.key; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
227 if (! isempty (key)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
228 hlgnd = [hlgnd, htmp(idx)]; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
229 tlgnd = {tlgnd{:}, key}; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
230 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
231 endfor |
6302 | 232 |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
233 x_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
234 y_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
235 z_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
236 fmt_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
237 properties = {}; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
238 elseif (! x_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
239 x = new; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
240 x_set = 1; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
241 elseif (! y_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
242 y = new; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
243 y_set = 1; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
244 elseif (! z_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
245 z = new; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
246 z_set = 1; |
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 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
|
249 if (isvector (z)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
250 x = x(:); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
251 y = y(:); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
252 z = z(:); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
253 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
|
254 [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
|
255 else |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
256 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
|
257 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
258 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
259 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
260 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
|
261 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
|
262 elseif (ndims (x) > 2) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
263 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
|
264 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
265 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
266 options = __default_plot_options__ (); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
267 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
|
268 linestyle = options.linestyle; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
269 marker = options.marker; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
270 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
|
271 [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
|
272 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
273 color = options.color; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
274 if (isempty (color)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
275 color = __next_line_color__ (); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
276 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
277 |
26217
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
278 htmp(++idx) = __go_line__ (hax, "xdata", x(:, i), "ydata", y(:, i), |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
279 "zdata", z(:, i), |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
280 "color", color, "linestyle", linestyle, |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
281 "marker", marker, properties{:}); |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
282 key = options.key; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
283 if (! isempty (key)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
284 hlgnd = [hlgnd, htmp(idx)]; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
285 tlgnd = {tlgnd{:}, key}; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
286 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
287 endfor |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
288 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
289 x = new; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
290 y_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
291 z_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
292 fmt_set = 0; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
293 properties = {}; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
294 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
295 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
296 endwhile |
6459 | 297 |
298 if (property_set) | |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
299 error ("plot3: properties must appear followed by a value"); |
6459 | 300 endif |
6004 | 301 |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
302 ## Handle last plot. |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
303 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
304 if (x_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
305 if (y_set) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
306 if (! z_set) |
10549 | 307 z = imag (y); |
308 y = real (y); | |
309 z_set = 1; | |
310 endif | |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
311 else |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
312 y = real (x); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
313 z = imag (x); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
314 y_set = 1; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
315 z_set = 1; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
316 if (rows (x) > 1) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
317 x = repmat ((1:rows (x))', 1, columns (x)); |
10549 | 318 else |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
319 x = 1:columns (x); |
10549 | 320 endif |
6459 | 321 endif |
6004 | 322 |
323 if (isvector (x) && isvector (y)) | |
10549 | 324 if (isvector (z)) |
325 x = x(:); | |
326 y = y(:); | |
327 z = z(:); | |
328 elseif (length (x) == rows (z) && length (y) == columns (z)) | |
329 [x, y] = meshgrid (x, y); | |
330 else | |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
331 error ("plot3: [length(X), length(Y)] must match size (Z)"); |
10549 | 332 endif |
6004 | 333 endif |
334 | |
7292 | 335 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
|
336 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
|
337 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
|
338 error ("plot3: X, Y, and Z must not have more than two dimensions"); |
6004 | 339 endif |
340 | |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
341 options = __default_plot_options__ (); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
342 |
8078
4665276ff7f6
correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents:
8075
diff
changeset
|
343 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
|
344 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
|
345 marker = options.marker; |
10549 | 346 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
|
347 [linestyle, marker] = __next_line_style__ (); |
10549 | 348 endif |
349 color = options.color; | |
350 if (isempty (color)) | |
351 color = __next_line_color__ (); | |
352 endif | |
8078
4665276ff7f6
correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents:
8075
diff
changeset
|
353 |
26217
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
354 htmp(++idx) = __go_line__ (hax, "xdata", x(:, i), "ydata", y(:, i), |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
355 "zdata", z(:, i), |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
356 "color", color, "linestyle", linestyle, |
31267a10f8a9
Use __go_line__ directly in plot scripts for performance.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
357 "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
|
358 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
|
359 if (! isempty (key)) |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
360 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
|
361 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
|
362 endif |
8078
4665276ff7f6
correctly plot matrices in plot3
David Bateman <dbateman@free.fr>
parents:
8075
diff
changeset
|
363 endfor |
5837 | 364 endif |
6257 | 365 |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
366 if (! isempty (hlgnd)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
367 legend (hax, hlgnd, tlgnd); |
5837 | 368 endif |
6257 | 369 |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
370 if (! ishold ()) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
371 set (hax, "view", [-37.5, 30]); |
6257 | 372 endif |
373 | |
17055
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
374 unwind_protect_cleanup |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
375 if (! isempty (oldfig)) |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
376 set (0, "currentfigure", oldfig); |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
377 endif |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
378 end_unwind_protect |
5837 | 379 |
24818
d55e100aebc9
plot3.m: Return an empty matrix when no plot is created (bug #53215).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
380 if (nargout > 0) |
d55e100aebc9
plot3.m: Return an empty matrix when no plot is created (bug #53215).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
381 h = htmp; |
6302 | 382 endif |
383 | |
5837 | 384 endfunction |
7245 | 385 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14184
diff
changeset
|
386 |
7245 | 387 %!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
|
388 %! clf; |
7245 | 389 %! z = [0:0.05:5]; |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
390 %! plot3 (cos (2*pi*z), sin (2*pi*z), z); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21580
diff
changeset
|
391 %! legend ("helix"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21580
diff
changeset
|
392 %! 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
|
393 |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
394 %!demo |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
395 %! clf; |
9fe930c5abbf
plot3.m: Update to use __plt_get_axis_arg__ and newplot.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
396 %! z = [0:0.05:5]; |
18924
9a5e03801d23
Update some plot %!demos so that they run under Matlab.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
397 %! plot3 (z, exp (2i*pi*z)); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21580
diff
changeset
|
398 %! legend ("complex sinusoid"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21580
diff
changeset
|
399 %! title ("plot3() with complex input"); |