1 ## Copyright (C) 2006-2012 Michel D. Schmid
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} {} stem (@var{x})
21 ## @deftypefnx {Function File} {} stem (@var{x}, @var{y})
22 ## @deftypefnx {Function File} {} stem (@var{x}, @var{y}, @var{linespec})
23 ## @deftypefnx {Function File} {} stem (@dots{}, "filled")
24 ## @deftypefnx {Function File} {@var{h} =} stem (@dots{})
25 ## Plot a stem graph from two vectors of x-y data. If only one argument
26 ## is given, it is taken as the y-values and the x coordinates are taken
27 ## from the indices of the elements.
29 ## If @var{y} is a matrix, then each column of the matrix is plotted as
30 ## a separate stem graph. In this case @var{x} can either be a vector,
31 ## the same length as the number of rows in @var{y}, or it can be a
32 ## matrix of the same size as @var{y}.
34 ## The default color is @code{"b"} (blue). The default line style is
35 ## @code{"-"} and the default marker is @code{"o"}. The line style can
36 ## be altered by the @code{linespec} argument in the same manner as the
37 ## @code{plot} command. For example,
48 ## plots 10 stems with heights from 2 to 20 in red;
50 ## The optional return value @var{h} is a vector of "stem series" graphics
51 ## handles with one handle per column of the variable @var{y}. The
52 ## handle regroups the elements of the stem graph together as the
53 ## children of the "stem series" handle, allowing them to be altered
54 ## together. For example,
59 ## y = [sin(x), cos(x)]
61 ## set (h(2), "color", "g");
62 ## set (h(1), "basevalue", -1)
67 ## changes the color of the second "stem series" and moves the base line
69 ## @seealso{bar, barh, plot}
72 ## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
75 function h = stem (varargin)
81 tmp = __stem__ (false, varargin{:});
105 %! h = stem (x, y, "r");
111 %! h = stem (x, y, "-.k");
117 %! h = stem (x, y, "-.k.");
123 %! h = stem (x, y, "filled");
128 %! y = [sin(x), cos(x)];
130 %! set (h(2), "color", "g");
131 %! set (h(1), "basevalue", -1)