Calculate a shift for plotting overlapping points
shiftpoints.RdCalculate a shift to add to overlapping points in plots for better visibility
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
FALSEthe 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.
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