stem

Creates a stem plot in an axis and returns the stem handles.

Syntax

h = stem(y)

h = stem(x, y)

h = stem(x, y, fmt)

h = stem(... property, value, ...)

h = stem(hAxes, ...)

Inputs

x,y
Range of the x and y axes.
Type: double | integer
Dimension: scalar | vector | matrix
fmt
The formatting string for the curve. It can be any combination for the following strings:
  1. line style: '-', '-.', ':', '--".
  2. line color: 'r', 'g', 'b', 'c', 'y', 'm', 'w', 'b'.
  3. marker style: 's', 'o', 'd', 'x', 'v', '^', '+', '*', '.'.
Type: string
Dimension: scalar
property
Properties that control the appearance or behavior of the graphics object .
Type: string
Dimension: scalar
value
Value of properties.
Type: double | integer | string
Dimension: scalar | vector
hAxes
Axis handle.
Type: double
Dimension: scalar

Outputs

h
The handle of the stem graphics object.

Examples

Simple stem example:

clf;
stem(rand(1,10))


stem example with format and property options:

clf;
x=linspace(0, 2*pi, 100);
y=sin(x);
stem(x,y, '--g', 'linestyle', ':');


Comments

If there is no axis, one will be created first. If x is omitted, the index of y is used as data to associate with the the x axis. Stem takes optional arguments to control the stem style. It can be either a format string, property/value pair(s), or both. If the first argument of stem() is an axis handle, lines will be created in that axis:
h = plot(hAxes, ...)