Scatter over-plotted points evenly at random and dodge groups side-to-side
position_bluenoisedodge.RdThis function dodges groups of points side-to-side and then scatters the
points that share a position across an elliptical field, spacing them evenly.
See the position_bluenoise() documentation for more information.
Usage
position_bluenoisedodge(
scatter.width = NULL,
scatter.height = NULL,
dodge.width = 1,
candidates = 10,
seed = NA,
orientation = "x"
)Arguments
- scatter.width, scatter.height
The dimensions of the elliptical field the points are spread across.
- dodge.width
The dodging width, which defaults to 1.
- candidates
The number of random draws considered for each point.
- seed
A random seed for reproducibility.
- orientation
The axis along which groups are separated, either
"x"(the default, side-to-side) or"y"(up and down). Matches the argument of the same name inggplot2::position_dodge().
Examples
library(ggplot2)
dat <- data.frame(x = rep(1, 400), y = rep(1, 400),
group = sample(LETTERS[1:2], 400, replace = TRUE))
ggplot(dat, aes(x, y, shape = group, color = group)) +
geom_point(position = position_bluenoisedodge(scatter.width = 0.4,
scatter.height = 0.4,
dodge.width = 1)) +
coord_cartesian(xlim = c(0, 2), ylim = c(0, 2))