eclarke / ggbeeswarm

Column scatter / beeswarm-style plots in ggplot2
GNU General Public License v3.0
531 stars 31 forks source link

Feature request - compact beeswarm #62

Closed jtrim-ons closed 1 year ago

jtrim-ons commented 3 years ago

We recently added a new "compactswarm" method to the beeswarm package (version 0.4.0, on CRAN). We haven't yet added a vignette with nice examples, but you can see some examples in this issue. It's often seems to be quite a big improvement on method="swarm" As ggbeeswarm no longer depends on beeswarm, would it be worth adding an implementation of compact beeswarms?

I might have time to help with this if you think it's a good plan. An alternative would be to depend on the beeswarm package for compact beeswarms. (An advantage of this is that the beeswarm package uses a fast C implementation.)

jtrim-ons commented 3 years ago

@csdaw would you have any interest in having a go at this? It would be amazing if you did feel like implementing it, as you know much more about ggbeeswarm and ggplot than I do.

The R version from the beeswarm package is here. (The default implementation is actually in C; the main part of that version is here.)

csdaw commented 3 years ago

@jtrim-ons Yep I'd be happy to add the compactswarm method in a future PR. ggbeeswarm definitely still depends on beeswarm so it should be easy enough to incorporate this new method.

jtrim-ons commented 3 years ago

@csdaw amazing - thank you! Let me know if there's anything I can do to help.

It would be great if the README could include an example (or more) of the compact beeswarm after you've added the code to the package. Again, I'd be happy to help with this if you'd like me to. I think the compact swarm would improve the "With automatic dodging" example in particular.

I was also wondering about what the API might look like... I guess options include adding another parameter to geom_beeswarm or creating a new geom_compactswarm function. I don't really have an opinion about this, but it would be really nice if the existence of the compact beeswarm is made fairly obvious to users. I guess that's what the README is for!

Thanks again for offering to write the code.

bersbersbers commented 3 years ago

compactswarm has just been added to ggbeeswarm2, see https://github.com/csdaw/ggbeeswarm2/issues/1.