# Animation using Julia and Plotly in Jupyter Notebook

**URL:** <https://community.plotly.com/t/animation-using-julia-and-plotly-in-jupyter-notebook/57529>\
**Category:** Plotly Julia\
**Created:** [October 13, 2021, 12:38pm UTC](https://community.plotly.com/t/animation-using-julia-and-plotly-in-jupyter-notebook/57529 "2021-10-13T12:38:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![valeroc](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/valeroc/32/16541_2.png) [@valeroc](https://community.plotly.com/u/valeroc)\
**Post date:** [October 13, 2021, 12:38pm UTC](https://community.plotly.com/t/animation-using-julia-and-plotly-in-jupyter-notebook/57529/1 "2021-10-13T12:38:57Z")

</div>

Hi, I am happy to share some code that shows how to do animations using Julia and PlotlyJS on a Jupyter Notebook.

![JuliaPlotlyAnim](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/9/b/9bbecf33e1ade8ddc73b3700fd7a4b631448dfa9.gif)

On the first cell of a Jupyter Notebook insert

```auto
using PlotlyJS

t = LinRange(0.0,2*pi,250)
ω1 = 2
ω2 = 3
a0 = 0
trace = scatter(x=cos.(ω1*t),y=sin.(ω2*a0*t),mode="lines", name="Lissajous") 
data = [trace]
layout = Layout(;title="Animation", xaxis_range=[-2, 2],
                     yaxis_range=[-2, 2], width=500,height=500)
pl = plot(data,layout)

```

On the next cell

```auto
a1 = 1
for a in LinRange(a0,a1,100)
    trace = scatter(x=cos.(ω1*t),y=sin.(ω2*a*t),mode="lines", name="Lissajous") 
    data = [trace]
    sleep(0.05)
    react!(pl, data, layout)
end

```
