position_jitternudge: Simultaneously nudge and jitter

View source: R/position_jitternudge.R

position_jitternudgeR Documentation

Simultaneously nudge and jitter

Description

Simultaneously nudge and jitter

Usage

position_jitternudge(
  jitter.width = NULL,
  jitter.height = 0,
  nudge.x = 0,
  nudge.y = 0,
  seed = NA
)

Arguments

jitter.width

degree of jitter in x direction. Defaults to 40% of the resolution of the data.

jitter.height

degree of jitter in y direction. Defaults to 0.

nudge.x

the amount to nudge in the x direction.

nudge.y

the amount to nudge in the y direction.

seed

Optional seed for the random jitter

Value

Positions for data in a ggplot2::ggplot object, similar to e.g. ggplot2::position_jitter

See Also

ggplot2::position_jitter(), which is the basis of this function.

Examples

library(ggplot2)
dsub <- diamonds[ sample(nrow(diamonds), 1000), ]
ggplot(dsub, aes(x = cut, y = carat, fill = clarity)) +
  geom_boxplot(outlier.size = 0) +
  geom_point(pch = 21, position = position_jitterdodge())

sdamr documentation built on Nov. 17, 2022, 1:06 a.m.