R/geom_swarm.R

# shortcut geoms for beeswarm-like plots
#
# Author: mjskay
###############################################################################

#' @rdname ggdist-ggproto
#' @format NULL
#' @usage NULL
#' @import ggplot2
#' @export
GeomSwarm = ggproto("GeomSwarm", GeomDots,
  default_aes = defaults(aes(
    side = "both"
  ), GeomDots$default_aes),

  default_params = defaults(list(
    overflow = "compress",
    binwidth = quote(unit(1.5, "mm")),
    layout = "swarm"
  ), GeomDots$default_params)
)

#' @eval rd_dotsinterval_shortcut_geom("swarm", "beeswarm", from_name = "dots")
#' @export
geom_swarm = make_geom(GeomSwarm)


#' @rdname ggdist-ggproto
#' @format NULL
#' @usage NULL
#' @import ggplot2
#' @export
GeomWeave = ggproto("GeomWeave", GeomSwarm,
  default_params = defaults(list(
    layout = "weave"
  ), GeomSwarm$default_params)
)

#' @eval rd_dotsinterval_shortcut_geom("weave", "dot-weave", from_name = "dots")
#' @export
geom_weave = make_geom(GeomWeave)

Try the ggdist package in your browser

Any scripts or data that you put into this service are public.

ggdist documentation built on July 4, 2024, 9:08 a.m.