Add multiple lines to a plot_ly graph with add_trace

前端 未结 3 1595
日久生厌
日久生厌 2021-02-20 06:59

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

3条回答
  •  再見小時候
    2021-02-20 07:53

    You need to set evaluate = TRUE to force evalutation / avoid lazy evaluation

    p <- plot_ly()
    p
    for(line in my_lines) {  p <- add_trace(p, y=line[['y']], x=line[['x']], 
                     marker=list(color=line[['color']]),
                     evaluate = TRUE)
    }
    p
    

提交回复
热议问题