4

このように、各プロットに2つの軸を持つマルチプロットを行いたい

library(plotly)
ay <- list(
  tickfont = list(color = "green"),
  overlaying = "y",
  side = "right", title = "y2 axis title"
)


par(mfrow=c(2,1))
ax <-list(title = "x axis title")
ay1 <-list(title = "y1 axds title")
plot_ly(x = 1:3, y = 10*(1:3), name = "slope of 10") %>%
  add_trace(x = 2:4, y = 1:3, name = "slope of 1", yaxis = "y2") %>%
  layout(title = "Double Y Axis", yaxis2 = ay, xaxis = ax, yaxis = ay1) 


 ax <-list(title = "x axis title")
 ay1 <-list(title = "y1 axds title")
 plot_ly(x = 1:3, y = 10*(1:3), name = "slope of 10") %>%
   add_trace(x = 2:4, y = 1:3, name = "slope of 1", yaxis = "y2") %>%
   layout(title = "Double Y Axis", yaxis2 = ay, xaxis = ax, yaxis = ay1) 

しかし、そのコードを実行すると、まだ 1 つのプロットしか表示されません。マルチプロットはできplotlyますか?2軸で面取りできますか?

4

1 に答える 1