shiftpoints: Calculate a shift for plotting overlapping points
Description
Calculate a shift to add to overlapping points in plots for better visibility
Usage
shiftpoints(x, y, sh=( max(x)-min(x))/100, centered=TRUE, method=1, reg=6,
na.rm=TRUE)
Value
Returns an array of shift values with the same dimension
as x.
Arguments
x
a data matrix or numeric vector for use in a plot.
y
a data matrix or numeric vector for use in a plot.
sh
the maximum total shift.
centered
logical, whether the shift is centered at 0, if FALSE
the shift will be positive only.
method
numeric, can have the value 1 or 2, see Details.
reg
numeric, see Details.
na.rm
logical, indicating whether missing values should be removed.
Author
Ulrike Naumann and David Warton <David.Warton@unsw.edu.au>.
Details
This function is similar to jitter but is defines for points in
a two-dimensional plot. In contrast to jitter only the points with ties
have a shift different from 0. The method to calculate the shift is therefore
not based on random numbers.
If method=1 (default) the individual shift will be selected so that the
shift range is sh, without regard of the number of overlapping points method=2 means that for up to reg overlapping values a fixed
shift of sh/reg is used