Description Usage Arguments Examples
View source: R/addNonOverlappingTestLabelsOrPoints.R
This function is similar to the points()
function but it will attempt to re-locate points that will overlap
1 2 3 4 5 6 7 8 9 10 11 12 |
xCoords |
A vector containing the X coordinates for labels |
yCoords |
A vector containing the Y coordinates for labels |
col.line |
The colour of the line to plot from relocated points to original location. Defaults to "black". Multiple colours can be provided. If more colours than labels provided colours will be recycled. |
lty |
A number detailing the type of line to plot from relocated labels to original location. 0: blank, 1: solid, 2: dashed, 3: dotted, 4: dotdash, 5: longdash, and 6: twodash. Defaults to 1. Multiple line types can be provided. If more options than labels provided types will be recycled. |
lwd |
A number to scale the size of line from relocated labels to original location. Defaults to 1. Multiple line widths can be provided. If more options than labels provided widths will be recycled. |
keepInside |
A logical variable indicating whether the points shouldn't be plotted outside of plotting region. Defaults to TRUE |
cex |
A number used to scale the size of the points plotted. Defaults to 1 |
avoidFactor |
A number that increases (values > 1) or decreases (values < 1) the amount of space alloted to each point. Defaults to 1 |
bg |
A character string that defines the background colour of our point. Defaults to NULL |
... |
Arguments to be passed to the |
1 2 3 4 5 6 7 8 9 10 | # Create some random points
n <- 50
coords <- data.frame(X=runif(n), Y=runif(n), Name="Test Label")
# Plot points and allow overlapping
plot(x=coords$X, y=coords$Y, bty="n", xaxt="n", yaxt="n", cex=3, xlab="X", ylab="Y")
# Plot points and avoid overlapping
plot(x=NULL, y=NULL, xlim=range(coords$X), ylim=range(coords$Y), bty="n", xaxt="n", yaxt="n", xlab="X", ylab="Y")
addPoints(coords$X, coords$Y, cex=3, col.line="red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.