I used the following code to get a eCDF plot:
df %>% group_by(group1, group2) %>%
summarise(n = length(unique(sessionID))) %>%
ggplot(aes(n)) +
stat_ecdf(geom = "step") +
scale_x_continuous(n.breaks = 30) +
theme_classic()
I would like to add quartiles, mean, and median to the plot, somewhat similar to the plot below.


My suggestion is to just calculate the quantiles outside the plot and use an extra data.frame as input to the annotation layers.
Created on 2022-10-27 by the reprex package (v2.0.0)