library(ggplot2)
dat <- data.frame(x = rep(1, 500), y = rep(1, 500))
# Jitter on an ellipse.
ggplot(dat, aes(x, y)) +
geom_point(position = position_jitter_ellipse(width = 0.5, height = 0.5)) +
coord_cartesian(xlim = c(0, 2), ylim = c(0, 2))
# Jitter on a rectangle, for comparison.
ggplot(dat, aes(x, y)) +
geom_point(position = position_jitter(width = 0.5, height = 0.5)) +
coord_cartesian(xlim = c(0, 2), ylim = c(0, 2))
Run the code above in your browser using DataLab