Missing data when Supplying a Dual-axis--Multiple-traces to subplot

◇◆丶佛笑我妖孽 提交于 2019-11-28 02:27:57

Looking at this issue on github This turned out to be a in .

Referencing to the link above, what we need to do is explicitly defining the y axes for all the plots, all the axes. Look below for its implementation on my example:

## Creating axis layouts, explicitly for all y axes
L_Axis <- list(tickfont = list(color = "red"), overlaying = "y",
               side = "right", title = "Lft")

F_Axis <- list(side = "left", title = "fmgd")

P_Axis <- list(side = "left", title = "prcp")


pp1 <- fmean1 %>% group_by(grp) %>%  plot_ly() %>%
  add_lines(x = ~hour, y = ~fmgd, name = "FMGD", colour = "blue") %>%
  add_lines(x = ~hour, y = ~lft, name = "Lft", yaxis = "y2", colour = "red") %>%
  layout( yaxis  = F_Axis, #left axis
          yaxis2 = L_Axis, #right axis
          title = "Fbay", xaxis = list(title="Date"))



pp2 <- prcpf1 %>% plot_ly() %>%
  add_bars(x=~Datetime, y=~precip, name = "prcp", yaxis = "y", colour = "green") %>% 
  layout(yaxis = P_Axis) #only y axis, on the left



pp <- subplot(pp1, pp2 , nrows = 2 , titleY = T, shareX = T)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!