Hi there,
If you add stat_boxplot(geom = 'errorbar')
you'll get what you want. Compare a
(your code) to b
(your code augmented with stat_boxplot()
) below:
library(tidyverse)
library(gridExtra)
#>
#> Attaching package: 'gridExtra'
#> The following object is masked from 'package:dplyr':
#>
#> combine
a <- ggplot(data=mpg, mapping=aes(x=class, y=hwy)) + geom_boxplot()
b <- ggplot(data=mpg, mapping=aes(x=class, y=hwy)) + geom_boxplot() + stat_boxplot(geom = 'errorbar')
grid.arrange(a, b, nrow = 2)
Created on 2018-10-04 by the reprex package (v0.2.0).
Hope this helps!