Search code examples
rggplot2boxplotggpubr

R: What is 'pointrange' in ggboxplot?


I need to confirm what the ggboxplot error.plot parameter's default value of 'pointrange' is referring to when plotting the box-plot whiskers. Is that the IQR * 1.5, or are they confidence intervals?

I had a look at the source code but couldn't tell from there

Many thanks!


Solution

  • ggpubr::ggboxplot calls ggplot2::geom_boxplot under the hood and uses the geom_boxplot defaults to draw the whiskers. Hence, from the docs of ?geom_boxplot:

    The upper whisker extends from the hinge to the largest value no further than 1.5 * IQR from the hinge. The lower whisker extends from the hinge to the smallest value at most 1.5 * IQR of the hinge.

    We can confirm that visually by adding a default geom_boxplot side-by-side to a ggboxplot:

    library(ggpubr)
    #> Loading required package: ggplot2
    library(ggplot2)
    
    df <- ToothGrowth
    
    ggboxplot(df, x = "dose", y = "len", width = 0.25) +
      geom_boxplot(
        aes(x = stage(dose, after_stat = x + .25)),
        width = .25, color = "red"
      )