diff --git a/R/ggbetweenstats.R b/R/ggbetweenstats.R index e1f0a844e..3473b7e55 100644 --- a/R/ggbetweenstats.R +++ b/R/ggbetweenstats.R @@ -63,7 +63,11 @@ #' @param point.args A list of additional aesthetic arguments to be passed to #' the [`ggplot2::geom_point()`]. #' @param boxplot.args A list of additional aesthetic arguments passed on to -#' [`ggplot2::geom_boxplot()`]. +#' [`ggplot2::geom_boxplot()`]. By default, the whiskers extend to 1.5 times +#' the interquartile range (IQR) from the box (Tukey-style). To customize +#' whisker length, you can use the `coef` parameter, e.g., +#' `boxplot.args = list(coef = 3)` for whiskers extending to 3 * IQR, or +#' `boxplot.args = list(coef = 0)` to show only the range of the data. #' @param violin.args A list of additional aesthetic arguments to be passed to #' the [`ggplot2::geom_violin()`]. #' @param ggplot.component A `ggplot` component to be added to the plot prepared diff --git a/vignettes/web_only/faq.Rmd b/vignettes/web_only/faq.Rmd index 27f1cdd6f..4321285cd 100644 --- a/vignettes/web_only/faq.Rmd +++ b/vignettes/web_only/faq.Rmd @@ -671,6 +671,40 @@ ggwithinstats( ) ``` +## 30. How to modify the whiskers in box plots from ggbetweenstats? + +By default, the whiskers in `ggbetweenstats()` box plots extend to 1.5 times the +interquartile range (IQR) from the box, following the Tukey method. You can +customize this using the `coef` parameter in `boxplot.args`: + +```{r} +# Default whiskers (1.5 * IQR) +ggbetweenstats( + data = mtcars, + x = am, + y = wt, + results.subtitle = FALSE +) + +# Longer whiskers (3 * IQR) +ggbetweenstats( + data = mtcars, + x = am, + y = wt, + boxplot.args = list(coef = 3), + results.subtitle = FALSE +) + +# Whiskers only to data range (no multiplier) +ggbetweenstats( + data = mtcars, + x = am, + y = wt, + boxplot.args = list(coef = 0), + results.subtitle = FALSE +) +``` + ## Suggestions If you find any bugs or have any suggestions/remarks, please file an issue on