[request] Beeswarm ordered like
Hello,
I wish there was a way of replicating the GraphPad Prism scatter plots in R. Specifically, the "standard" method that preserves the distribution of the datapoints:
Is there a way to do it in R? with ggbeeswarm I am no achieve it, and I think this package would be the best to have this option.
Hi @eggrandio,
Could you give a reproducible example with ggbeeswarm that shows how it does not do what you want?
It will help me understand your request.
Hello,
library(ggplot2)
library(ggbeeswarm)
# Example data
df <- data.frame(
group = rep(c("A", "B", "C"), each = 20),
value = c(rnorm(20, mean = 5), rnorm(20, mean = 7), rnorm(20, mean = 6))
)
# Basic beeswarm plot
ggplot(df, aes(x = group, y = value)) +
geom_beeswarm(cex = 3, size = 2, color = "steelblue") +
theme_minimal() +
labs(title = "Beeswarm plot example", x = "Group", y = "Value")
Gives:
When there are two points, one of them is centered and the other is moved to the right. In Graphpad, when there are two overlapping or close points, they are placed symmetrically from the center. This applies to any even number of points.