Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bounce

Separate plotting positions for labels, to avoid overlap


Description

Return univariate plotting positions in which neighboring points are separated, if and as necessary, so that they are the specified minimum distance apart.

Usage

bounce(y, d, log = FALSE)

Arguments

y

A numeric vector of plotting positions

d

Minimum required distance between neighboring positions

log

TRUE if values are will be plotted on a logarithmic scale.

Details

The centroid(s) of groups of points that are moved relative to each other remain the same.

Value

A vector of values such that, when plotted along a line, neighboring points are the required minimum distance apart.

Note

If values are plotted on a logarithmic scale, d is the required distance apart on that scale. If a base other than 10 is required, set log equal to that base. (Note that base 10 is the default for plot with log=TRUE.)

Author(s)

John Maindonald

See Also

See also onewayPlot

Examples

bounce(c(4, 1.8, 2, 6), d=.4)
bounce(c(4, 1.8, 2, 6), d=.1, log=TRUE)

DAAG

Data Analysis and Graphics Data and Functions

v1.24
GPL-3
Authors
John H. Maindonald and W. John Braun
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.