You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like Plotly can execute the plot_ly() command properly when there is a secondary axis, but it drops them when multiple plots are stacked together via the subplot() command. See the example below where var2 is represented properly in graph p1 on a secondary axis, but gets dropped when subplot() is called to stack that with another graph p2:
library(plotly)
set.seed(11)
# initialize a 5-record data.table with 4 random normal seriesdf<-data.frame(date= c("1980", "1981", "1982", "1983", "1984"),
var1= rnorm(5), var2=10* rnorm(5), var3= rnorm(5),
var4=10* rnorm(5))
# plot var1 & var2 on the same plot, different axesp1<- plot_ly(df, type='scatter', mode='lines') %>%
add_trace(x=~date, y=~var1, name="var1") %>%
add_trace(x=~date, y=~var2, name="var2", yaxis="y2") %>%
layout(yaxis2=list(side="right", overlaying="y", zeroline=FALSE))
p1# plot var3 & var4 on the same plot, same axisp2<- plot_ly(df, type='scatter', mode='lines') %>%
add_trace(x=~date, y=~var3, name="var3") %>%
add_trace(x=~date, y=~var4, name="var4")
p2# stack plots p1 & p2plots<- subplot(p1, p2, nrows=2, shareY=F, shareX=F)
plots
The text was updated successfully, but these errors were encountered:
It looks like Plotly can execute the plot_ly() command properly when there is a secondary axis, but it drops them when multiple plots are stacked together via the subplot() command. See the example below where var2 is represented properly in graph p1 on a secondary axis, but gets dropped when subplot() is called to stack that with another graph p2:
The text was updated successfully, but these errors were encountered: