shiftpoints | R Documentation |

Calculate a shift to add to overlapping points in plots for better visibility

shiftpoints(x, y, sh=( max(x)-min(x))/100, centered=TRUE, method=1, reg=6, na.rm=TRUE)

`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 |

`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. |

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

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

.

Ulrike Naumann and David Warton <David.Warton@unsw.edu.au>.

`plot.mvabund `

, `plot.mvformula`

,
`jitter`

.

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.