1## Copyright (C) 2006, 2007, 2008, 2009 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} {@var{h} =} stem (@var{x}, @var{y}, @var{linespec})
21## @deftypefnx {Function File} {@var{h} =} stem (@dots{}, "filled")
22## Plot a stem graph from two vectors of x-y data. If only one argument
23## is given, it is taken as the y-values and the x coordinates are taken
24## from the indices of the elements.
26## If @var{y} is a matrix, then each column of the matrix is plotted as
27## a separate stem graph. In this case @var{x} can either be a vector,
28## the same length as the number of rows in @var{y}, or it can be a
29## matrix of the same size as @var{y}.
31## The default color is @code{"r"} (red). The default line style is
32## @code{"-"} and the default marker is @code{"o"}. The line style can
33## be altered by the @code{linespec} argument in the same manner as the
34## @code{plot} command. For example
39## y = ones (1, length (x))*2.*x;
45## plots 10 stems with heights from 2 to 20 in blue;
47## The return value of @code{stem} is a vector if "stem series" graphics
48## handles, with one handle per column of the variable @var{y}. This
49## handle regroups the elements of the stem graph together as the
50## children of the "stem series" handle, allowing them to be altered
51## together. For example
56## y = [sin(x), cos(x)]
58## set (h(2), "color", "g");
59## set (h(1), "basevalue", -1)
64## changes the color of the second "stem series" and moves the base line
66## @seealso{bar, barh, plot}
69## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net>
72function h = stem (varargin)
78 tmp = __stem__ (false, varargin{:});
92%! y = ones (1, length (x))*2.*x;
97%! y = ones (size (x))*2.*x;
98%! h = stem (x, y, "b");
102%! y = ones (size (x))*2.*x;
103%! h = stem (x, y, "-.k");
107%! y = ones (size (x))*2.*x;
108%! h = stem (x, y, "-.k.");
112%! y = ones (size (x))*2.*x;
113%! h = stem (x, y, "fill");
117%! y = [sin(x), cos(x)];
119%! set (h(2), "color", "g");
120%! set (h(1), "basevalue", -1)