[ top | up ]

Add Points to a Plot

Syntax

points(x, y, pch="o", ...)
points.default(x, y=NULL, pch=1, col="black", ...)

Arguments

x, y coordinate vectors of points to plot.
pch plotting 'character', i.e. symbol to use. pch can either be a character or an integer code for a set of graphics symbols. The full set of S symbols is available with pch=0:18.

In addition, there is a special set of R plotting symbols which can be obtained with pch=19:25 and can be colored and filled with different colors: pch=19: solid circle, pch=20: bullet, pch=21: circle, pch=22: square, pch=23: diamond, pch=24: triangle point-up, pch=25: triangle point down.

col color to use.
... Further graphical parameters (see par) may also be supplied as arguments.

Description

points is a generic function to draw a sequence of points at the specified coordinates. The specified character(s) are plotted, centered at the coordinates.

Graphical parameters are permitted as arguments to this function.

See Also

plot, lines.

Examples

plot(-4:4, -4:4, type = 'n')# setting up coord. system points(rnorm(200), rnorm(200), col = 'red') points(rnorm(100)/2, rnorm(100)/2, col = 'blue', cex = 1.5) ## Showing all the graphics symbols ipch <- 1:25 iy <- 3 + 4-(ipch-1) %% 5 ix <- (ipch-1) %/% 5 plot(ix, iy, type='n', axes = F, xlab = '', ylab = '', main = 'plot symbols : points (.. pch = * )') abline(v=ix, h=iy, col = "lightgray", lty = "dotted") for(i in ipch) { # red symbols with a yellow interior (where available) points(ix[i], iy[i], pch=i, col="red", bg="yellow", cex = 15) text (ix[i] - .3, iy[i], i, col="brown", cex = 1.5) }