lines(x, y, type="l") points(x, y, type="p")
"p"
,
"l"
,
"b"
,
"o"
,
"n"
,
"s"
and
"h"
produce points,
lines, both, both (overlaid), nothing, stairsteps and high-density lines.
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).
Some graphics devices use characters from special fonts for these
marks, but they should roughly resemble the above descriptions.
Using the numbers
32
through
126
for
pch
yields the 95 ASCII
characters from space through tilde (see the S-PLUS 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.
Often these functions are used after calling
plot
with
type="n"
;
this sets up the axis system but does not plot any points.
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()