7017
|
1 ## Copyright (C) 2006, 2007 Michel D. Schmid |
6303
|
2 ## |
6440
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
6303
|
6 ## under the terms of the GNU General Public License as published by |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
6303
|
9 ## |
6440
|
10 ## Octave is distributed in the hope that it will be useful, but |
6303
|
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 |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
6303
|
18 |
|
19 ## -*- texinfo -*- |
|
20 ## @deftypefn {Function File} {@var{h} =} stem (@var{x}, @var{y}, @var{linespec}) |
6506
|
21 ## Plot a stem graph and return the handles of the line and marker |
6303
|
22 ## objects used to draw the stems. The default color is @code{"r"} |
6895
|
23 ## (red). The default line style is @code{"-"} and the default marker is |
6303
|
24 ## @code{"o"}. |
|
25 ## |
|
26 ## For example, |
|
27 ## @example |
|
28 ## x = 1:10; |
|
29 ## stem (x); |
|
30 ## @end example |
|
31 ## @noindent |
6509
|
32 ## plots 10 stems with heights from 1 to 10; |
6303
|
33 ## |
|
34 ## @example |
|
35 ## x = 1:10; |
|
36 ## y = ones (1, length (x))*2.*x; |
|
37 ## stem (x, y); |
|
38 ## @end example |
|
39 ## @noindent |
6509
|
40 ## plots 10 stems with heights from 2 to 20; |
6303
|
41 ## |
|
42 ## @example |
|
43 ## x = 1:10; |
|
44 ## y = ones (size (x))*2.*x; |
|
45 ## h = stem (x, y, "b"); |
|
46 ## @end example |
|
47 ## @noindent |
6509
|
48 ## plots 10 bars with heights from 2 to 20 |
6303
|
49 ## (the color is blue, and @var{h} is a 2-by-10 array of handles in |
7001
|
50 ## which the first row holds the line handles and |
6303
|
51 ## the second row holds the marker handles); |
|
52 ## |
|
53 ## @example |
|
54 ## x = 1:10; |
|
55 ## y = ones (size (x))*2.*x; |
|
56 ## h = stem (x, y, "-.k"); |
|
57 ## @end example |
|
58 ## @noindent |
6509
|
59 ## plots 10 stems with heights from 2 to 20 |
6303
|
60 ## (the color is black, line style is @code{"-."}, and @var{h} is a 2-by-10 |
|
61 ## array of handles in which the first row holds the line handles and |
7001
|
62 ## the second row holds the marker handles); |
6303
|
63 ## |
|
64 ## @example |
|
65 ## x = 1:10; |
|
66 ## y = ones (size (x))*2.*x; |
|
67 ## h = stem (x, y, "-.k."); |
|
68 ## @end example |
|
69 ## @noindent |
6509
|
70 ## plots 10 stems with heights from 2 to 20 |
6303
|
71 ## (the color is black, line style is @code{"-."} and the marker style |
|
72 ## is @code{"."}, and @var{h} is a 2-by-10 array of handles in which the |
|
73 ## first row holds the line handles and the second row holds the marker |
|
74 ## handles); |
|
75 ## |
|
76 ## @example |
|
77 ## x = 1:10; |
|
78 ## y = ones (size (x))*2.*x; |
|
79 ## h = stem (x, y, "fill"); |
|
80 ## @end example |
|
81 ## @noindent |
6506
|
82 ## plots 10 stems with heights from 2 to 20 |
6303
|
83 ## (the color is rgb-triple defined, the line style is @code{"-"}, |
|
84 ## the marker style is @code{"o"}, and @var{h} is a 2-by-10 array of |
|
85 ## handles in which the first row holds the line handles and the second |
|
86 ## row holds the marker handles). |
|
87 ## |
|
88 ## Color definitions with rgb-triples are not valid! |
|
89 ## @seealso{bar, barh, plot} |
|
90 ## @end deftypefn |
|
91 |
|
92 ## Author: Michel D. Schmid <michaelschmid@users.sourceforge.net> |
|
93 ## Adapted-by: jwe |
|
94 |
|
95 function h = stem (varargin) |
|
96 |
7217
|
97 tmp = __stem__ (false, varargin{:}); |
6303
|
98 |
|
99 if (nargout > 0) |
7217
|
100 h = tmp; |
6303
|
101 endif |
|
102 |
|
103 endfunction |