See also https://community.plot.ly/t/point-ordering-in-ribbon-graph/4110
d <- data.frame(
x = c(seq(1:10),2:3),
y = c(1:12)
)
d <- dplyr::arrange(d, x)
d$cumulative <- cumsum(d$y)
ggplot(d, aes(x, ymin = 0, ymax = cumulative)) + geom_ribbon()
ggplotly()