[英]How can I put plotly bar chart on the top layer
我试图在 R 中使用 Plotly 将条形图放在其他图表的顶部,但无法正确显示。 任何帮助,将不胜感激。 谢谢!
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))
)
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.