[ top | up ]

Add Connected Line Segments to a Plot

Syntax

lines(x, y, ...)

Description

lines takes the coordinates given in the x and y vectors and joins those points with line segments. The coordinates can alternatively be passed to lines in a plotting structure (a list with x and y components), a time series, etc.

Graphical parameters can also be specified as arguments.

Examples

# draw a smooth line through a scatter plot plot(cars, main="Stopping Distance versus Speed") lines(lowess(cars))