Mercurial > hg > octave-nkf
annotate scripts/plot/scatter3.m @ 9785:ccad98db781b
gnuplot_drawnow.m: Support gnuplot's dumb terminal.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 08 Nov 2009 17:15:07 -0500 |
parents | 10b9a71a81f1 |
children | be55736a0783 |
rev | line source |
---|---|
9245 | 1 ## Copyright (C) 2007, 2008, 2009 David Bateman |
7189 | 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 | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
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 | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
7603
689652eb95d1
fix for scatter markersize
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
20 ## @deftypefn {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s}, @var{c}) |
7189 | 21 ## @deftypefnx {Function File} {} scatter3 (@dots{}, 'filled') |
22 ## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{style}) | |
23 ## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{prop}, @var{val}) | |
24 ## @deftypefnx {Function File} {} scatter3 (@var{h}, @dots{}) | |
25 ## @deftypefnx {Function File} {@var{h} =} scatter3 (@dots{}) | |
26 ## | |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
27 ## Plot a scatter plot of the data in 3D. A marker is plotted at each point |
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
28 ## defined by the points in the vectors @var{x}, @var{y} and @var{z}. The size |
8069
c64c9581e9bf
fix documentation of scatter3
Martin Weiser <weiser2@natur.cuni.cz>
parents:
7603
diff
changeset
|
29 ## of the markers used is determined by @var{s}, which can be a scalar or |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
30 ## a vector of the same length of @var{x}, @var{y} and @var{z}. If @var{s} is |
8069
c64c9581e9bf
fix documentation of scatter3
Martin Weiser <weiser2@natur.cuni.cz>
parents:
7603
diff
changeset
|
31 ## not given or is an empty matrix, then the default value of 8 points is used. |
7189 | 32 ## |
33 ## The color of the markers is determined by @var{c}, which can be a string | |
34 ## defining a fixed color, a 3 element vector giving the red, green and blue | |
35 ## components of the color, a vector of the same length as @var{x} that gives | |
36 ## a scaled index into the current colormap, or a @var{n}-by-3 matrix defining | |
37 ## the colors of each of the markers individually. | |
38 ## | |
39 ## The marker to use can be changed with the @var{style} argument, that is a | |
40 ## string defining a marker in the same manner as the @code{plot} command. | |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
41 ## If the argument 'filled' is given then the markers as filled. All |
7189 | 42 ## additional arguments are passed to the underlying patch command. |
43 ## | |
44 ## The optional return value @var{h} provides a handle to the patch object | |
45 ## | |
46 ## @example | |
47 ## @group | |
48 ## [x, y, z] = peaks (20); | |
49 ## scatter3 (x(:), y(:), z(:), [], z(:)); | |
50 ## @end group | |
51 ## @end example | |
52 ## | |
53 ## @seealso{plot, patch, scatter} | |
54 ## @end deftypefn | |
55 | |
56 function retval = scatter3 (varargin) | |
57 | |
7215 | 58 [h, varargin, nargin] = __plt_get_axis_arg__ ("scatter3", varargin{:}); |
59 | |
7189 | 60 if (nargin < 2) |
61 print_usage (); | |
7215 | 62 else |
7189 | 63 oldh = gca (); |
64 unwind_protect | |
65 axes (h); | |
66 newplot (); | |
7215 | 67 tmp = __scatter__ (h, 3, "scatter3", varargin{:}); |
7189 | 68 unwind_protect_cleanup |
69 axes (oldh); | |
70 end_unwind_protect | |
71 endif | |
72 | |
73 if (! ishold ()) | |
74 set (get (tmp, "parent"), "view", [-37.5, 30]); | |
75 endif | |
76 | |
77 if (nargout > 0) | |
78 retval = tmp; | |
79 endif | |
80 | |
81 endfunction | |
7245 | 82 |
83 %!demo | |
84 %! [x, y, z] = peaks (20); | |
85 %! scatter3 (x(:), y(:), z(:), [], z(:)); | |
9295
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
86 |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
87 %!demo |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
88 %! x = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
89 %! y = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
90 %! z = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
91 %! scatter3 (x(:), y(:), z(:), 10, z(:), "s"); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
92 |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
93 %!demo |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
94 %! x = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
95 %! y = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
96 %! z = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
97 %! scatter3 (x(:), y(:), z(:), 20*z(:), z(:), "s"); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
98 |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
99 %!demo |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
100 %! x = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
101 %! y = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
102 %! z = rand (20,1); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
103 %! scatter3 (x(:), y(:), z(:), 20*z(:), [], "s"); |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
104 |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
105 |
10b9a71a81f1
__scatter__.m: If the color spec is empty, set using __next_line_color__.
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
106 |