When I run the following lines:
library(plotly)
set.seed(1)
x <- 1:100
y1 <- sin(seq(1, 2*pi, length.out = 100))
y2 <- cos(seq(1, 2*pi, length.out = 100))
plotdata <- rbind(data.frame(x=x, fct = replicate(100, 'sin'), y=y1, lower = (y1+runif(100, -1, -0.5)), upper = (y1+runif(100, 0.5, 1))),
data.frame(x=x, fct = replicate(100, 'cos'), y=y2, lower = (y2+runif(100, -1, -0.5)), upper = (y2+runif(100, 0.5, 1))))
p <-
ggplot(plotdata, aes(group = fct)) +
geom_line(aes(y=y, x=x)) +
geom_ribbon(aes(x=x, ymin=lower, ymax=upper), alpha = 0.3)
p
ggplotly(p)
p
displays as expected:
Which is not the case with
ggplotly(p)
Any advice on how to display properly semi-transparent overlaying parts would be welcome.