Probably my question may be a duplicate, but I am unable to do it in ggplot2 (tidyverse) only?
I want to add count of number of observations and median to each group/element of a box-plot in ggplot2
Here is the reprex
library(tidyverse)
set.seed(123)
df <- iris %>% sample_n(100)
df %>%
mutate(grp = ifelse(Sepal.Width > mean(Sepal.Width), 'Gr-1', 'Gr-2')) %>%
ggplot(aes(x = Species, y = Sepal.Length, fill = grp)) +
geom_boxplot() +
coord_flip() +
facet_wrap(. ~ grp)

Created on 2021-06-24 by the reprex package (v2.0.0)
Expected outcome something like this for all 6 boxes

