lines {graphics}R Documentation

Add Connected Line Segments to a Plot

Description

A generic function taking coordinates given in various ways and joining the corresponding points with line segments.

Usage

lines(x, ...)

## Default S3 method:
lines(x, y = NULL, type = "l", col = par("col"),
      lty = par("lty"), ...)

Arguments

x, y coordinate vectors of points to join.
type character indicating the type of plotting; actually any of the types as in plot.
col color to use. This can be vector of length greater than one, but only the first value will be used.
lty line type to use.
... Further graphical parameters (see par) may also be supplied as arguments, particularly, line type, lty and line width, lwd.

Details

The coordinates can be passed to lines in a plotting structure (a list with x and y components), a ="R argblock"> rect a list with components

w, h
positive numbers giving width and height of the legend's box.
left, top
x and y coordinates of upper left corner of the box.
text a list with components
x, y
numeric vectors of length length(legend), giving the x and y coordinates of the legend's text(s).

returned invisibly.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

plot, barplot which uses legend(), and text for more examples of math expressions.

Examples

## Run the example in '?matplot' or the following:
leg.txt <- c("Setosa     Petals", "Setosa     Sepals",
             "Versicolor Petals", "Versicolor Sepals")
y.leg <- c(4.5, 3, 2.1, 1.4, .7)
cexv  <- c(1.2, 1, 4/5, 2/3,