thigmophobe {plotrix}R Documentation

Find the direction away from the closest point

Description

Find the direction away from the closest point

Usage

 thigmophobe(x,y,plot.span=par("usr"),xlog=par("xlog"),ylog=par("ylog"))

Arguments

x,y

Numeric data vectors. Typically the x/y coordinates of plotted points. If arrays are passed, they will be silently coerced to numeric vectors.

plot.span

The extent of the plot in user units.

xlog,ylog

Flags for logarithmic axes. See Note.

Details

thigmophobe returns the direction (as 1|2|3|4 - see pos= in text) away from the nearest point to each of the points described by x and y.

Value

A vector of directions away from the point nearest to each point.

Note

thigmophobe is typically used to get the offset to automatically place labels on a scatterplot or similar using thigmophobe.labels to avoid overlapping labels. The name means "one who fears being touched".

The plot.span, xlog and ylog arguments were added to allow thigmophobe to be used outside of base graphics.

Author(s)

Jim Lemon - thanks to Gustaf Rydevik for the "names" bug fix, Steve Ellison for the suggestion about arrays and Duncan Murdoch for the additional arguments.

See Also

thigmophobe.labels

Examples

 x<-rnorm(10)
 y<-rnorm(10)
 thigmophobe(x,y)

[Package plotrix version 3.7-3 Index]