full text label on Boxplot, with added mean point
This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 4 years ago . Am trying to get text label similar to what this https://stats.stackexchange.com/questions/8206/labeling-boxplots-in-r , but I cant get it to work. MWE similar to what I have is this: data <- data.frame(replicate(5,sample(0:100,100,rep=TRUE))) meanFunction <- function(x){ return(data.frame(y=round(mean(x),2),label=round(mean(x,na.rm=T),2)))} ggplot(melt(data), aes(x=variable, y=value)) + geom_boxplot(aes(fill=variable), width = 0.7) + stat_summary(fun.y = mean, geom="point"