Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain exact y values when using geom_beeswarm(method="center") #95

Open
jbengler opened this issue Jun 22, 2024 · 2 comments
Open

Retain exact y values when using geom_beeswarm(method="center") #95

jbengler opened this issue Jun 22, 2024 · 2 comments

Comments

@jbengler
Copy link

jbengler commented Jun 22, 2024

Hi @eclarke,

thanks for this great package!

I noticed that geom_beeswarm(method="center") nicely centers the points. However, it also changes the y position resulting in binned and thus "inaccurate" y values.

Without method="center" correct y values are displayed
center_off

With method="center" y value position is "inaccurate"
center_on

I would love to have the best of both worlds: centered points that faithfully recapitulate the real y value.

I know that this is possible in plotting tools like Prism, which does a great job in positioning points. However, a ggplot version of this would be fantastic!

@eclarke
Copy link
Owner

eclarke commented Nov 15, 2024

Hi @jbengler, could you provide a reproducible example I can test against? Just the code and dummy data would be sufficient. Thanks!

@jbengler
Copy link
Author

jbengler commented Nov 16, 2024

Hi @eclarke,

thanks for looking into this!

If I run the two examples below, I see the y-position of the lower dots changing. As if method="center" would apply a y-axis binning.

tibble::tibble(score = c(23,24,32,37,45,150)) %>% 
  ggplot2::ggplot(aes(x = NA, y = score)) +
  ggbeeswarm::geom_beeswarm(cex = 3, method="center")

tibble::tibble(score = c(23,24,32,37,45,150)) %>% 
  ggplot2::ggplot(aes(x = NA, y = score)) +
  ggbeeswarm::geom_beeswarm(cex = 3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants