knitr::opts_chunk$set( fig.retina=2, fig.width=6, fig.height=4, fig.path = "man/figures/README-" )
This is a fork of ggbeeswarm which is in an experimental and unfinished state. Some of changes made here including additional swarming and corral methods are now available in the development version of ggbeeswarm, which is probably what you should be using.
I plan on trying out re-writing these functions (again) so that the swarming is performed based on the plotting area and size of the plotting character as opposed to just the x/y range of the data (as in ggbeeswarm).
The position_beeswarm
function has been
rewritten and is compatible with R >= v4.0.0. Additionally, position_beeswarm
works almost identically to the beeswarm
function from the
beeswarm package
with all the additional methods implemented (including the new compactswarm
).
For example:
set.seed(123) distro <- list(runif = runif(100, min = -3, max = 3), rnorm = rnorm(100)) # beeswarm beeswarm::beeswarm(distro, col = 2:3, pch = 16, method = "hex", main = "title") # ggbeeswarm2 library(dplyr) library(ggbeeswarm2) distro2 <- as.data.frame(rev(distro)) %>% tidyr::pivot_longer( everything(), values_to = "value", names_to = "variable" ) ggplot2::ggplot(distro2, aes(x = rev(variable), y = value)) + geom_beeswarm(method = "hex") + scale_y_continuous(limits = c(-3, 3))
Author: Charlotte Dawson
Original authors: Erik Clarke and Scott Sherrill-Mix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.