Description Usage Arguments Details Value Examples
Labels a list of points on a two-dimensional plot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
x |
The vector of x coordinates or a formula of the form |
... |
Other arguments to be passed to |
y |
The vector of y coordinates. |
lbls |
The name of the variable in |
pts |
The vector of row numbers corresponding to the points to highlight. If left as |
col |
A numeric or string indicating the color to use when labeling the points. |
cex |
A numeric characther expansion number for the point labels. |
pos |
A numeric indicating where to place the labels (see |
data |
The data frame from which the formula should be evaluated. |
A two dimensional plot must be active and the x
and y
vectors must correspond to the x- and y-axes of the plot or x
must correspond to the formula used to produce the plot.
None, but an active graphic is modified.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | df <- data.frame(x=runif(10),y=runif(10),grp=factor(rep(c("Yes","No"),each=5)))
plot(y~x,data=df)
# highlight the first and second points with default positioning using the formula notation
highlight(y~x,data=df,lbls=grp,pts=c(1,2))
# highlight the third and fourth points with user-chosen positioning
highlight(y~x,data=df,lbls=grp,pts=c(3,4),pos=c(1,2),col="blue")
# highlight the fifth and sixth points illustrating lack of data= argument
with(df,highlight(y~x,lbls=grp,pts=c(5,6),col="orange"))
# highlight the seventh and eighth points illustrating no use of formula
with(df,highlight(x,y,lbls=grp,pts=c(7,8),col="yellow"))
# highlight the ninth and tenth points with numeric labeling
highlight(y~x,data=df,pts=c(9,10),col="green")
# label all points with their row numbers
plot(y~x,data=df)
highlight(y~x,data=df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.