njudd / ggrain

{package} Make beautiful Raincloud plots in R!
Other
67 stars 4 forks source link

Issue with Bandwidth Control in geom_rain #11

Closed irenerlover closed 6 months ago

irenerlover commented 7 months ago

In the context of plotting density plots, I noticed that the geom_half_violin function was used. To adjust the bandwidth, I used the bw argument within this function. Here’s the sample code snippet:

library(ggrain)
library(tidyverse)
ggplot(iris, aes(1, Sepal.Width)) +
  geom_rain(bw = 0.1) +
  theme_classic() +
  theme(axis.title.x = element_blank(), 
        axis.text.x = element_blank(), axis.ticks.x = element_blank())

While I successfully modified the bandwidth, a warning message appeared:

Warning messages:
1: In (function (mapping = NULL, data = NULL, stat = "identity", position = "identity",  :
  Ignoring unknown parameters: `bw`
2: In (function (mapping = NULL, data = NULL, stat = "boxplot", position = "dodge2",  :
  Ignoring unknown parameters: `bw`

Would you kindly consider adding the bw argument directly to the geom_rain function to prevent this warning? Your attention to this matter would be greatly appreciated. Thank you! 🙏

njudd commented 7 months ago

Are you aware this can be implemented with the violin.args? Because this is a violin-specific argument it needs to get passed only to the violin. See the vignette.

ggplot(iris, aes(1, Sepal.Width)) +
       geom_rain(violin.args = list(bw = 0.1))