annotate scripts/plot/plot3.m @ 6172:2de853a110df

[project @ 2006-11-15 22:53:47 by jwe]
author jwe
date Wed, 15 Nov 2006 22:53:48 +0000
parents 045038e0108a
children 44c91c5dfe1d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 1996 John W. Eaton
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
2 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
4 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 2, or (at your option)
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
8 ## any later version.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
9 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
14 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
18 ## 02110-1301, USA.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
19
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
20 ## -*- texinfo -*-
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
21 ## @deftypefn {Function File} {} plot3 (@var{args})
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
22 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
23 ## This function produces three-dimensional plots. Many different
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
24 ## combinations of arguments are possible. The simplest form is
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
25 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
26 ## @example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
27 ## plot3 (@var{x}, @var{y}, @var{z})
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
28 ## @end example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
29 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
30 ## @noindent
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
31 ## where the arguments are taken to be the vertices of the points to be
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
32 ## plotted in three dimensions. If all arguments are vectors of the same
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
33 ## length, then a single continuous line is drawn. If all arguments are
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
34 ## matrices, then each column of the matrices is treated as a seperate
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
35 ## line. No attempt is made to transpose the arguments to make the
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
36 ## number of rows match.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
37 ##
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
38 ## Additionally, only two arguments can be given as
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
39 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
40 ## @example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
41 ## plot3 (@var{x}, @var{c})
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
42 ## @end example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
43 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
44 ## where the real and imaginary parts of the second argument are used as
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
45 ## the @var{y} and @var{z} coordinates, respectively.
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
46 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
47 ## If only one argument is given, as
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
48 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
49 ## @example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
50 ## plot3 (@var{c})
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
51 ## @end example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
52 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
53 ## the real and imaginary parts of the argument are used as the @var{y}
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
54 ## and @var{z} values, and they are plotted versus their index.
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
55 ##
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
56 ## To save a plot, in one of several image formats such as PostScript
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
57 ## or PNG, use the @code{print} command.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
58 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
59 ## An optional format argument can be given as
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
60 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
61 ## @example
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
62 ## plot3 (@var{x}, @var{y}, @var{z}, @var{fmt})
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
63 ## @end example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
64 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
65 ## If the @var{fmt} argument is supplied, it is interpreted as
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
66 ## follows. If @var{fmt} is missing, the default gnuplot line style
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
67 ## is assumed.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
68 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
69 ## @table @samp
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
70 ## @item -
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
71 ## Set lines plot style (default).
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
72 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
73 ## @item .
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
74 ## Set dots plot style.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
75 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
76 ## @item @@
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
77 ## Set points plot style.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
78 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
79 ## @item -@@
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
80 ## Set linespoints plot style.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
81 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
82 ## @item ^
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
83 ## Set impulses plot style.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
84 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
85 ## @item L
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
86 ## Set steps plot style.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
87 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
88 ## @item @var{n}
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
89 ## Interpreted as the plot color if @var{n} is an integer in the range 1 to
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
90 ## 6.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
91 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
92 ## @item @var{nm}
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
93 ## If @var{nm} is a two digit integer and @var{m} is an integer in the
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
94 ## range 1 to 6, @var{m} is interpreted as the point style. This is only
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
95 ## valid in combination with the @code{@@} or @code{-@@} specifiers.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
96 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
97 ## @item @var{c}
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
98 ## If @var{c} is one of @code{"k"}, @code{"r"}, @code{"g"}, @code{"b"},
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
99 ## @code{"m"}, @code{"c"}, or @code{"w"}, it is interpreted as the plot
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
100 ## color (black, red, green, blue, magenta, cyan, or white).
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
101 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
102 ## @item ";title;"
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
103 ## Here @code{"title"} is the label for the key.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
104 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
105 ## @item +
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
106 ## @itemx *
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
107 ## @itemx o
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
108 ## @itemx x
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
109 ## Used in combination with the points or linespoints styles, set the point
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
110 ## style.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
111 ## @end table
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
112 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
113 ## The color line styles have the following meanings on terminals that
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
114 ## support color.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
115 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
116 ## @example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
117 ## Number Gnuplot colors (lines)points style
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
118 ## 1 red *
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
119 ## 2 green +
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
120 ## 3 blue o
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
121 ## 4 magenta x
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
122 ## 5 cyan house
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
123 ## 6 brown there exists
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
124 ## @end example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
125 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
126 ## The @var{fmt} argument can also be used to assign key titles.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
127 ## To do so, include the desired title between semi-colons after the
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
128 ## formatting sequence described above, e.g. "+3;Key Title;"
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
129 ## Note that the last semi-colon is required and will generate an error if
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
130 ## it is left out.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
131 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
132 ## Arguments can also be given in groups of three as
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
133 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
134 ## @example
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
135 ## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{})
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
136 ## @end example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
137 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
138 ## @noindent
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
139 ## where each set of three arguments is treated as a seperate line or
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
140 ## set of lines in three dimensions.
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
141 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
142 ## To plot multiple one- or two-argument groups, separate each group with an
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
143 ## empty format string, as
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
144 ##
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
145 ## @example
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
146 ## plot3 (@var{x1}, @var{c1}, '', @var{c2}, '', @dots{})
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
147 ## @end example
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
148 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
149 ## An example of the use of plot3 is
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
150 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
151 ## @example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
152 ## @group
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
153 ## z = [0:0.05:5];
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
154 ## plot3(cos(2*pi*z), sin(2*pi*z), z, ";helix;");
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
155 ## plot3(z, exp(2i*pi*z), ";complex sinusoid;");
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
156 ## @end group
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
157 ## @end example
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
158 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
159 ## @seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour, __pltopt__
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
160 ## bar, stairs, errorbar, replot, xlabel, ylabel, title, print}
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
161 ## @end deftypefn
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
162
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
163 ## Author: Paul Kienzle
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
164 ## (modified from __plt__.m)
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
165
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
166 function plot3 (varargin)
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
167
6172
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
168 __plot_globals__;
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
169
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
170 cf = __current_figure__;
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
171 mxi = __multiplot_xi__(cf);
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
172 myi = __multiplot_yi__(cf);
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
173
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
174 hold_state = ishold ();
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
175
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
176 unwind_protect
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
177
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
178 x_set = 0;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
179 y_set = 0;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
180 z_set = 0;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
181
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
182 ## Gather arguments, decode format, and plot lines.
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
183 for arg = 1:nargin
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
184 new = varargin{arg};
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
185
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
186 if (ischar (new))
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
187 if (! z_set)
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
188 if (! y_set)
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
189 if (! x_set)
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
190 error ("plot3: needs x, [ y, [ z ] ]");
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
191 else
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
192 z = imag (x);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
193 y = real (x);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
194 y_set = 1;
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
195 z_set = 1;
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
196 if (rows(x) > 1)
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
197 x = repmat ((1:rows(x))', 1, columns(x));
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
198 else
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
199 x = 1:columns(x);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
200 endif
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
201 endif
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
202 else
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
203 z = imag (y);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
204 y = real (y);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
205 z_set = 1;
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
206 endif
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
207 endif
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
208 [fmt, key] = __pltopt__ ("plot3", new);
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
209
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
210 if (isvector (x) && isvector (y))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
211 if (isvector (z))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
212 x = x(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
213 y = y(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
214 z = z(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
215 elseif (length (x) == rows (z) && length (y) == columns (z))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
216 error ("plot3: [length(x), length(y)] must match size(z)");
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
217 else
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
218 [x, y] = meshgrid (x, y);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
219 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
220 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
221
6157
045038e0108a [project @ 2006-11-13 22:22:53 by jwe]
jwe
parents: 6146
diff changeset
222 if (! size_equal (x, y) || ! size_equal (x, z))
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
223 error ("plot3: x, y, and z must have the same shape");
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
224 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
225
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
226 __gnuplot_raw__ ("set nohidden3d;\n")
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
227
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
228 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ...
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
229 ([y; NaN*ones(1,size(y,2))])(:), ...
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
230 ([z; NaN*ones(1,size(z,2))])(:)],
6172
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
231 true, "u($1):($2):($3)", fmt{1}, key{1});
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
232
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
233 hold ("on");
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
234 x_set = 0;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
235 y_set = 0;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
236 z_set = 0;
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
237 elseif (! x_set)
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
238 x = new;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
239 x_set = 1;
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
240 elseif (! y_set)
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
241 y = new;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
242 y_set = 1;
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
243 elseif (! z_set)
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
244 z = new;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
245 z_set = 1;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
246 else
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
247 if (isvector (x) && isvector (y))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
248 if (isvector (z))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
249 x = x(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
250 y = y(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
251 z = z(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
252 elseif (length (x) == rows (z) && length (y) == columns (z))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
253 error ("plot3: [length(x), length(y)] must match size(z)");
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
254 else
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
255 [x, y] = meshgrid (x, y);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
256 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
257 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
258
6157
045038e0108a [project @ 2006-11-13 22:22:53 by jwe]
jwe
parents: 6146
diff changeset
259 if (! size_equal (x, y) || ! size_equal (x, z))
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
260 error ("plot3: x, y, and z must have the same shape");
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
261 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
262
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
263 __gnuplot_raw__ ("set nohidden3d;\n")
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
264
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
265 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ...
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
266 ([y; NaN*ones(1,size(y,2))])(:), ...
6172
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
267 ([z; NaN*ones(1,size(z,2))])(:)], true);
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
268
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
269 hold ("on");
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
270 x = new;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
271 y_set = 0;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
272 z_set = 0;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
273 endif
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
274
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
275 endfor
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
276
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
277 ## Handle last plot.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
278
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
279 if (x_set)
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
280 if (y_set)
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
281 if (! z_set)
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
282 z = imag (y);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
283 y = real (y);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
284 z_set = 1;
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
285 endif
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
286 else
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
287 z = imag (x);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
288 y = real (x);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
289 y_set = 1;
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
290 z_set = 1;
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
291 if (rows (x) > 1)
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
292 x = repmat ((1:rows (x))', 1, columns(x));
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
293 else
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
294 x = 1:columns(x);
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
295 endif
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
296 endif
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
297
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
298 if (isvector (x) && isvector (y))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
299 if (isvector (z))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
300 x = x(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
301 y = y(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
302 z = z(:);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
303 elseif (length (x) == rows (z) && length (y) == columns (z))
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
304 error ("plot3: [length(x), length(y)] must match size(z)");
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
305 else
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
306 [x, y] = meshgrid (x, y);
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
307 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
308 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
309
6157
045038e0108a [project @ 2006-11-13 22:22:53 by jwe]
jwe
parents: 6146
diff changeset
310 if (! size_equal (x, y) || ! size_equal (x, z))
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
311 error ("plot3: x, y, and z must have the same shape");
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
312 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
313
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
314 __gnuplot_raw__ ("set nohidden3d;\n")
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5910
diff changeset
315
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
316 __plt3__ ([([x; NaN*ones(1,size(x,2))])(:), ...
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6078
diff changeset
317 ([y; NaN*ones(1,size(y,2))])(:), ...
6172
2de853a110df [project @ 2006-11-15 22:53:47 by jwe]
jwe
parents: 6157
diff changeset
318 ([z; NaN*ones(1,size(z,2))])(:)], true);
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
319 endif
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
320
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
321 unwind_protect_cleanup
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
322
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
323 if (! hold_state)
5910
101d966c8d6b [project @ 2006-07-28 03:40:22 by jwe]
jwe
parents: 5838
diff changeset
324 hold ("off");
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
325 endif
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
326
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
327 end_unwind_protect
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
328
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
329 endfunction