avoid | R Documentation |
Generate a vector of positions to use to minimise text overlaps in labelled scatterplots
avoid(x, ...) ## S4 method for signature 'numeric' avoid( x, y, ..., xlog = par("xlog"), ylog = par("ylog"), usr = par("usr"), pin = par("pin"), eps = .Machine$double.eps, pi = base::pi ) ## S4 method for signature 'xy' avoid(x, ...)
x, y |
any of the forms that the coordinates of a scatterplot may be specified |
... |
additional arguments for methods |
xlog, ylog |
logicals: are the x- and/or y-scales logarithmic? |
usr, pin |
graphics parameters |
eps |
numeric: a zero tolerance |
pi |
numeric: the value of the arithmetic constant of the same name |
a vector of integers all of which are 1, 2, 3, or 4, indicating placement positions.
set.seed(123) z <- complex(real = runif(50), imaginary = runif(50)) mz <- mean(z) z <- z[order(Arg(z - mz))] plot(z, axes = FALSE, ann = FALSE) segments(Re(mz), Im(mz), Re(z), Im(z)) abline(h = Im(mz), v = Re(mz), lwd = 0.5) box() text(Re(z), Im(z), pos = avoid(z), cex = 0.7, offset = 0.25, col = "red", font = 2, xpd = NA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.