Hi,
This post is somehow connected with that solved post:
https://forum.posit.co/t/mean-and-median-in-one-boxplot/148382/13
I would like to add description of outliers to this plot:
smry_text <- PlantGrowth |>
group_by(group) |>
summarise(across(.cols=weight,
.fns = list(mean=mean,median=median))) |>
mutate(mean_text = paste0("Mean : ",weight_mean),
median_text = paste0("\n\nMedian : ",weight_median))
ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) +
geom_boxplot() +
stat_summary(fun=mean, color="darkred",geom="crossbar", show.legend=TRUE) +
geom_text(data = smry_text, aes(label = median_text,
y=weight_mean),
,nudge_y = -.2) +
geom_text(data = smry_text, aes(label = mean_text,
y=weight_mean),
,nudge_y = -.2,color="darkred" , fontface = "bold")
I would like to add horizontal lines to whiskers as well.
My previous attempts are documented in forementioned linked above post.
Thank you for your help, ideas.