1 ## Copyright (C) 2007-2012 David Bateman
3 ## This file is part of Octave.
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.
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.
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/>.
20 ## @deftypefn {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s}, @var{c})
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{})
27 ## Plot a scatter plot of the data in 3D@. A marker is plotted at each point
28 ## defined by the points in the vectors @var{x}, @var{y} and @var{z}. The size
29 ## of the markers used is determined by @var{s}, which can be a scalar or
30 ## a vector of the same length of @var{x}, @var{y} and @var{z}. If @var{s} is
31 ## not given or is an empty matrix, then the default value of 8 points is used.
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.
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.
41 ## If the argument 'filled' is given then the markers as filled. All
42 ## additional arguments are passed to the underlying patch command.
44 ## The optional return value @var{h} is a graphics handle to the hggroup
45 ## object representing the points.
49 ## [x, y, z] = peaks (20);
50 ## scatter3 (x(:), y(:), z(:), [], z(:));
54 ## @seealso{plot, patch, scatter}
57 function retval = scatter3 (varargin)
59 [h, varargin, nargin] = __plt_get_axis_arg__ ("scatter3", varargin{:});
68 tmp = __scatter__ (h, 3, "scatter3", varargin{:});
69 unwind_protect_cleanup
75 set (h, "view", [-37.5, 30],
76 "xgrid", "on", "ygrid", "on", "zgrid", "on");
88 %! [x, y, z] = peaks (20);
89 %! scatter3 (x(:), y(:), z(:), [], z(:));
96 %! scatter3 (x(:), y(:), z(:), 10, z(:), "s");
103 %! scatter3 (x(:), y(:), z(:), 20*z(:), z(:), "s");
110 %! scatter3 (x(:), y(:), z(:), 20*z(:), [], "s");