fastshap icon indicating copy to clipboard operation
fastshap copied to clipboard

Feature: ggplot2-based beeswarm plot

Open kapsner opened this issue 3 years ago • 6 comments

This PR adds a ggplot2-based beeswarm plot to fastshap and closes #17.

The example plot from the unittest (https://github.com/kapsner/fastshap/blob/feat_beeswarm_plot/inst/tinytest/test_fastshap.R#L197) is as follows: fastshap_beeswarm

kapsner avatar Apr 28 '22 04:04 kapsner

The latest commit enhances the beeswarm plot by making use of the awesome R package ggbeeswarm https://github.com/eclarke/ggbeeswarm, resulting in beeswarm_plot

kapsner avatar Apr 29 '22 15:04 kapsner

The latest commit normalizes feature values between 0 and 1, resulting in beeswarm_plot n

kapsner avatar Apr 30 '22 05:04 kapsner

Hi @bgreenwell , when you take a closer look, there are some "challenges" to be considered:

All in all 6 new dependencies have been added for performing the data wrangling and visualizations:

magrittr dplyr utils tidyr viridis ggbeeswarm

Whereas ggbeeswarm is also imported via the DESCRIPTION file's "Remotes" section, since the argument corral from geom_beeswarm is not yet available the version that is released on CRAN.

This would currently disallow a fast CRAN release of fastshap, if one wants to make use of this argument. Alternatively, I have commented out the part without ggbeeswarm that uses plain ggplot2 and geom_jitter (https://github.com/kapsner/fastshap/blob/feat_beeswarm_plot/R/beeswarm.R#L110), which, however, does not look as nice.

To clarify the progress of ggbeeswarm's next CRAN release, I have opened this issue https://github.com/eclarke/ggbeeswarm/issues/74.

kapsner avatar May 01 '22 05:05 kapsner

Unfortunatelly, ggbeeswarm seems not to be actively maintained anymore (last CRAN upload in 2017). To get rid of this dependency, I've found geom_sina from the ggforce package, which results in a very similar depiction: beeswarm_plot

kapsner avatar May 01 '22 09:05 kapsner

Hi @bgreenwell , have you had already some time to take a closer look to this PR?

kapsner avatar Jun 02 '22 08:06 kapsner

Thanks @kapsner, I have not had a chance, but I will try to take a close look this week!

bgreenwell avatar Jun 05 '22 15:06 bgreenwell

Closing this in favor of reliance on the shapviz package.

bgreenwell avatar Oct 20 '22 14:10 bgreenwell