Low-level plotting commands Flashcards
points(x, y)
adds points (the option type= can be used)
lines(x, y)
id. but with lines
text(x, y, labels, …)
adds text given by labels at coordi-
nates (x,y); a typical use is: plot(x, y, type=”n”); text(x, y, names)
mtext(text, side=3, line=0, …)
adds text given by text in the margin specified by side (see axis() below); line specifies the line from the plotting area
segments(x0, y0, x1, y1)
draws lines from points (x0,y0) to points (x1,y1)
arrows(x0, y0, x1, y1, angle= 30, code=2)
id. with arrows at points (x0,y0) if code=2, at points (x1,y1) if code=1, or both if code=3; angle controls the angle from the shaft of the arrow to the edge of the arrow head
abline(a,b)
draws a line of slope b and intercept a
abline(h=y)
draws a horizontal line at ordinate y
abline(v=x)
draws a vertical line at abcissa x
abline(lm.obj)
draws the regression line given by lm.obj
rect(x1, y1, x2, y2)
draws a rectangle which left, right, bottom, and
top limits are x1, x2, y1, and y2, respectively
polygon(x, y)
draws a polygon linking the points with coordinates given
by x and y
legend(x, y, legend)
adds the legend at the point (x,y) with the sym-
bols given by legend
title()
adds a title and optionally a sub-title
axis(side, vect)
adds an axis at the bottom (side=1), on the left (2),
at the top (3), or on the right (4); vect (optional) gives the abcissa (or
ordinates) where tick-marks are drawn