I found an example to add lines to a plot_ly
plot by using the add_trace
command. How can I add a list of lines to plot without using add_trace>
I believe with the release of plotly 4.0
calling any of the add_*
family of functions forces evaluation so there is no need to call evaluate = T
anymore
So, something like this should work fine:
devtools::install_github("ropensci/plotly")
library(plotly)
p <- plot_ly()
for(i in 1:5){
p <- add_trace(p, x = 1:10, y = rnorm(10), mode = "lines")
}
p