Learn R Programming

ggbeeswarm (version 0.5.3)

position_beeswarm: Violin point-style plots to show overlapping points. x must be discrete.

Description

Violin point-style plots to show overlapping points. x must be discrete.

Usage

position_beeswarm(priority = c("ascending", "descending", "density", "random", "none"), cex = 1, groupOnX = NULL, dodge.width = 0)

Arguments

priority
Method used to perform point layout (see swarmx)
cex
Scaling for adjusting point spacing (see swarmx)
groupOnX
should jitter be added to the x axis if TRUE or y axis if FALSE (the default NULL causes the function to guess which axis is the categorical one based on the number of unique entries in each)
dodge.width
Amount by which points from different aesthetic groups will be dodged. This requires that one of the aesthetics is a factor.

See Also

position_quasirandom, swarmx

Other position.adjustments: position_quasirandom

Examples

Run this code

  ggplot2::qplot(class, hwy, data = ggplot2::mpg, geom='beeswarm')
  # Generate fake data
  distro <- data.frame(
    'variable'=rep(c('runif','rnorm'),each=100),
    'value'=c(runif(100, min=-3, max=3), rnorm(100))
  )
  ggplot2::qplot(variable, value, data = distro, geom='beeswarm')
  ggplot2::qplot(variable, value, data = distro) +
    geom_beeswarm(priority='density',cex=2.5)

Run the code above in your browser using DataLab