Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion R/ggbetweenstats.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions vignettes/web_only/faq.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down