Closed
Description
I was trying to put a bar chart on the top layer, but it is always on the bottom layer of other charts.
library(plotly)
dat1 <- data.frame(
date = as.Date(c("2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29","2020-03-30", "2020-03-31", "2020-04-01")),
value = c(1,3,5,7,5,3,1),
box = c(1,2,rep(4,5))
)
dat1
fig <- plot_ly(data = dat1, x = ~ date, y = ~ box, mode = "line+markers", type='scatter', stackgroup = 'one', fillcolor='#d8f4ef' )
fig <- fig %>% add_bars(data = dat1, x= ~date, y = ~ value, inherit = F)
fig