Hi, sorry my question is more theoretical.
I'm not clear on what the whiskers in the following represents: is it the standard deviation or the min/max values (except for the outliers)? Thanks
boxp <- ggplot(mtcars, aes(as.factor(cyl), wt, group = interaction(as.factor(cyl), as.factor(am)))) +
geom_bar(aes(fill=as.factor(am)), position = "dodge", stat = "summary", fun = "median") +
geom_boxplot(outlier.shape = NA, width=0.2, color = "black", fill = 'gray', position = position_dodge(0.9)) +
stat_boxplot(geom="errorbar", position = position_dodge(0.9)) +
stat_summary(aes(label=round(after_stat(y), 2), y = stage(wt, after_stat = 0)), fun=median, geom="text", size=8, col = "white", vjust=-0.5,position = position_dodge(0.9)) +
stat_summary(fun=mean, geom="point", shape=18, size=4, col="white", position = position_dodge(0.9)) +
labs(x = "Conditions", y = "Medians") +
scale_y_continuous(limits=c(0,7),oob = rescale_none) +
theme_bw()
boxp
Specifying the geom in stat_boxplot() or the stat in geom_boxplot()can be used to "to override the default connection between geom_boxplot and stat_boxplot."
For example, if you provided the layer with different data or mapped its aesthetics to a different variable, or if you wanted to manually provide the limits to the geometry shown, etc.
A layer combines data, aesthetic mapping, a geom (geometric object), a stat (statistical transformation), and a position adjustment. Typically, you will create layers using a geom_ function, overriding the default position and stat if needed.