Looking for some help with adding summary statistics like 0.25 and 0.75 percentile lines to ggplot boxplot.
My current code is as follows:
ggplot(aes(y = HT, x = LOCATION, fill = LOCATION, na.rm = TRUE), data = HD1) + geom_boxplot(notch = TRUE) +
scale_fill_manual(breaks = c("NVRN", "PCN"), values=c("sky blue", "red"))+
coord_cartesian(ylim=c(0,80)) +
geom_smooth(method="lm") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
My data is quite simple with one response and one predictor - the predictor has two categorical groups (2 locations) and I need to add the summary statistics directly onto the ggplot.
I have tried using different functions like add_summary and stat_summary to add percentile lines (in red) and means for both groups onto my ggplot. I cannot seem to figure out exactly how to do this with my code, any help would be much appreciated.
I hope this is enough information.
Thanks in advance
