Hi
Using stat_summary seems to be the only way I could find to create boxplots is non-standards statistics. This would work fine for me if I only could manage to control the box width. As you can see in the reprex below, geom_boxplot and stats_summary create boxes with different widths.
Any suggestion will be welcome.
mystats <- function(x){
stats <- boxplot.stats(x)$stats
names(stats) <- c('ymin', 'lower', 'middle', 'upper', 'ymax')
stats
}
myout <- function(x){
data.frame(y=boxplot.stats(x)[["out"]])
}
ggplot(mtcars, aes(x=factor(cyl), y=mpg)) + geom_boxplot()
ggplot(mtcars, aes(x=factor(cyl), y=mpg)) +
stat_summary(fun.data=mystats, geom="boxplot") +
stat_summary(fun.data=myout, geom="point")