Learn R Programming

mvabund (version 3.9.1)

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)

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.

Value

  • Returns an array of shift values with the same dimension as x.

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

See Also

plot.mvabund, plot.mvformula, jitter.

Examples

Run this code
shiftpoints( x=c(1:5, 1:10), y=c(2:6, 1:10) )

Run the code above in your browser using DataLab