Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Plot_ly () Animation takes too long to create

When animating using the plot_ly () function, the generated velocity takes too long.

t1<-Sys.time()
##################################
 library(plotly)
library(dplyr)
library(htmlwidgets)
##################################

df <- data.frame('a' = c(1:10000), 'b'= c(1:10000), 'c'=c(1:10000),'d'=c(1:10000), 
'e'=c(1:10000),'f'=c(1:10000),'g'=c(1:10000), 'h'=c(1:10000))

##################################
p <- plot_ly() %>% 

  add_trace(  data = df,
              x= ~a,
              y= ~b,
              z= ~c,
              opacity = 0.5,
              type = 'scatter3d', mode = 'lines',
              line = list( color= "#DD443C", dash="solid", width = 8),
              name ="test_Speed")

t2<-Sys.time()
#plotly
t2-t1       

saveWidget(as_widget(p), 'test.html')


t2<-Sys.time()
#html
t2-t1

In the above code task, the task is completed in 1.6 seconds. However, it takes more than three minutes for code with the frame variable added below. Also, the graph does not open properly when operated in a web browser.

t1<-Sys.time()
##################################
 library(plotly)
library(dplyr)
library(htmlwidgets)
##################################

df <- data.frame('a' = c(1:10000), 'b'= c(1:10000), 'c'=c(1:10000),'d'=c(1:10000), 
'e'=c(1:10000),'f'=c(1:10000),'g'=c(1:10000), 'h'=c(1:10000))

##################################
p <- plot_ly() %>% 

  add_trace(  data = df,
              x= ~a,
              y= ~b,
              z= ~c,
              frame = ~d,
              opacity = 0.5,
              type = 'scatter3d', mode = 'lines',
              line = list( color= "#DD443C", dash="solid", width = 8),
              name ="test_Speed")

t2<-Sys.time()
#plotly
t2-t1       

saveWidget(as_widget(p), 'test.html')


t2<-Sys.time()
#html
t2-t1

The plot_ly function is handled quickly, but I can see that saveWidget takes a lot of time.
I want to output a graph that animates in a dataframe with 200,000 rows.
Can I output a graph in a non-html format? (Animation possible)
Or is there a way to speed up the saveWidget? I need help.