I have a simply shiny app and i have two plotly charts there each with its Play
button.
I need to have one button that would animate both charts. How can I do it?
My code is below:
Plot 1:
output$plot1<-renderPlotly({
res<-df%>%
plot_ly(
x=~year,
y=~value,
showlegend = TRUE
)%>%add_lines()
res<-res%>%add_trace(
x=~year,
frame=~year,
y=~value,
color=~state,
type = 'scatter',
mode = 'markers',
showlegend = FALSE
)
return(res)
})
Plot 2:
output$plot2<-renderPlotly({
res2<- df2%>%
plot_ly(
x=~var,
y=~var2,
frame=~year,
type = 'bar')
return(res2)
})