Ggbeeswarm2
Column scatter / beeswarm-style plots in ggplot2
Install / Use
/learn @csdaw/Ggbeeswarm2README
ggbeeswarm2: Beeswarm-style plots with ggplot2
<!-- badges: start --> <!-- badges: end -->Note
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")
## [1] "par(\"usr\") = 0" "par(\"usr\") = 1" "par(\"usr\") = 0" "par(\"usr\") = 1"
## [1] "cex.out[1]: 1"
## [1] "par(\"cex\"): 1"
## [1] "cex: 1"
## [1] "spacing: 1"
## [1] "sizeMultiplier: 1"
## [1] "VERTICAL!"
## [1] "x.size = 0.0363025210084034"
## [1] "y.size = 0.243244296807423"
# ggbeeswarm2
library(dplyr)
library(ggbeeswarm2)
<img src="man/figures/README-ex-1.png" width="576" />
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))
<img src="man/figures/README-ex-2.png" width="576" />
## [1] "plot.ylim.short = -3" "plot.ylim.short = 3"
## [1] "y.range = 6"
Author: Charlotte Dawson
Original authors: Erik Clarke and Scott Sherrill-Mix
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
