labelPoints | R Documentation |
Labels points on a graph.
labelPoints(x, y, labels, dir = "E", offset = 0.75, size = 8, color = "black", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
x |
the x-axis data. Missing values are permitted, but ignored. |
y |
the y-axis data. Missing values are permitted, but ignored. |
labels |
the text labels, must be the same length as x and y. Missing values are permitted, but ignored. |
dir |
the direction relative to the point to place the label. See Details. |
offset |
the relative offset from the point. See Details. |
size |
character size in points. |
color |
the color of the labels. |
current |
the current plot controls. Typically, this would be the
output from one of the graph creation functions like |
The value for dir
can be of length one or the length of x
,
in which case, dir
applies to the corresponding point. The value must be
"N," "NE," "E," "SE," "S," "SW," "W," or "NW" cooresponding to the compass
direction or "C" to center the label.
The value for offset
can be of length one or the length of x
, in
in which case, offset
applies to the corresponding point. The value is relative
to the size of the test. The default value of offset
is correct for creating a
text plot, where the text is centered on the value.
A list containing x
, y
, and labels
.
The current version does not have any method to automatically eliminate
overlapping labels. Several iterations may be required trying various values for
dir
and possibly offset
to produce non overlapping labels.
addAnnotation
,, xyPlot
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() xyPlot(X, Y) # Label the first point labelPoints(X[1], Y[1], "First") # For more details of labelPoints see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.