There are some posts about plotting cumulative densities in ggplot. I\'m currently using the accepted answer from Easier way to plot the cumulative frequency distribution in
You can apply row_number over the groups, and utilize that as the Y aesthetic in a geom_step or other geometry. You'll just have to sort by X, or the values will appear as they do in the data frame, unordered.
ggplot(x %>%
group_by(A) %>%
arrange(X) %>%
mutate(rn = row_number())) +
geom_step(aes(x=X, y=rn, color=A))