Add Lines or Points to Current Plot

DESCRIPTION:
Adds points or lines to the current plot. The type of point and/or line can be specified as well as other graphical parameters.

USAGE:
lines(x, y, type="l")
points(x, y, type="p")

REQUIRED ARGUMENTS:
x,y:
coordinates of points. The coordinates can be given by two arguments that are vectors or by a single argument x which is a univariate time series, a complex vector, a matrix with 2 columns, or a list containing components named x and y.
Missing values (NA) are allowed.

OPTIONAL ARGUMENTS:
type=:
values of "p", "l", "b", "o", "n", "s" and "h" produce points, lines, both, both (overlaid), nothing, stairsteps and high-density lines.

Graphical parameters may also be supplied as arguments to this function (see par).


SIDE EFFECTS:
lines and/or points are added to the current plot.

DETAILS:
These are generic functions; currently, each of them only have a default method.

Data values with an NA in either x or y are not plotted by points. Also, lines does not draw to or from any such point, thus giving a break in the line segments.

The graphical parameter pch= can be used to plot special symbols at the points. Basic marks are: square (0); octagon (1); triangle (2); cross (3); X (4); diamond (5) and inverted triangle (6). To get superimposed versions of the above use the following arithmetic(!): 7==0+4; 8==3+4; 9==3+5; 10==1+3; 11==2+6; 12==0+3; 13==1+4; 14==0+2. Filled marks are square (15), octagon (16), triangle (17), and diamond (18). Use the mkh graphics parameter to control the size of these marks.

Using the numbers 32 through 126 for pch yields the 95 ASCII characters from space through tilde (see the SPLUS data set font). The numbers between 161 and 252 yield characters, accents, ligatures, or nothing, depending on the font (which is device dependent).

If a log scale is currently in effect for either the x- or y-axis, points and lines will plot the corresponding values on a log scale.


BACKGROUND:
Often these functions are used after calling plot with type="n"; this sets up the axis system but does not plot any points.

SEE ALSO:
segments , arrows , symbols , plot , matplot , par .

EXAMPLES:
low <- ozone.quartile < 1.8*ozone.median - 35
plot(ozone.median, ozone.quartile, type="n")
points(ozone.median[low], ozone.quartile[low], pch=15)
points(ozone.median[!low], ozone.quartile[!low], pch=0)

usa(xlim=range(ozone.xy$x), ylim=range(ozone.xy$y)) points(ozone.xy$x[low], ozone.xy$y[low], pch=15) points(ozone.xy$x[!low], ozone.xy$y[!low], pch=0)

# produce a plot of all the marks par(usr=c(-1,19,0,1)) for(i in 0:18) { points(i, .5, pch=i); text(i, .35, i) } text(9, .75, 'Samples of "pch=" Parameter') box()