ggprism icon indicating copy to clipboard operation
ggprism copied to clipboard

[request] Beeswarm ordered like

Open eggrandio opened this issue 6 months ago • 2 comments

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:

Image

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.

eggrandio avatar Jun 12 '25 11:06 eggrandio

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.

csdaw avatar Jun 17 '25 08:06 csdaw

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:

Image

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.

eggrandio avatar Jun 17 '25 09:06 eggrandio