As hinted but not implemented by @Roland, you can use stat_boxplot
to implement this. The trick calling _boxplot
twice and is to set the geom
to errorbar
for one of the calls.
Note that as R
uses a pen and paper approach it is advisable to implement the error bars first the draw the traditional boxplot over the top.
Using @Roland's dummy data df
ggplot(df, aes(x=cond, y = value)) +
stat_boxplot(geom ='errorbar') +
geom_boxplot() # shorthand for stat_boxplot(geom='boxplot')
The help for stat_boxplot
(?stat_boxplot
) detail the various values computed and saved in a data.frame
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…