# Can you update a plot in Julia?

**URL:** <https://discourse.julialang.org/t/can-you-update-a-plot-in-julia/22448>\
**Category:** New to Julia\
**Tags:** visualization\
**Created:** [March 28, 2019, 9:56am UTC](https://discourse.julialang.org/t/can-you-update-a-plot-in-julia/22448 "2019-03-28T09:56:01Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)\
**Post date:** [March 29, 2019, 12:29pm UTC](https://discourse.julialang.org/t/can-you-update-a-plot-in-julia/22448/3 "2019-03-29T12:29:25Z")

</div>

The Plots.jl documentation includes an example of an animation:

[http://docs.juliaplots.org/latest/examples/gr/#functions-adding-data-and-animations](http://docs.juliaplots.org/latest/examples/gr/#functions-adding-data-and-animations)

There are more details in the documentation, but I included a copy of the sample code here:

```julia
p = plot([sin, cos], zeros(0), leg=false)
anim = Animation()
for x = range(0, stop=10π, length=100)
    push!(p, x, Float64[sin(x), cos(x)])
    frame(anim)
end

```

I myself posted an example on how to do this directly with the InspectDR package (for faster refresh rates):

> [@Realtime plotting](https://discourse.julialang.org/t/realtime-plotting/15638/6):
>
> I was wondering how InspectDR would handle this myself… so I made a small test: using InspectDR using Colors function getmeasdata(t, φ) sigA = sin.(t .+ φ) sigB = cos.(t .+ φ) return (sigA, sigB) end #Build general structure of animation plot function buildanimplot() NPOINTS = 1000 NCYCLES = 2 #To display RED = RGB24(1, 0, 0) GREEN = RGB24(0, 1, 0) BLUE = RGB24(0, 0, 1) #collect: InspectDR does not take AbstractArray: t = collect(range(0, stop=NCYCLES\*2pi, length=NPOINTS)) (sigA, …

---

_[View the full topic](https://discourse.julialang.org/t/can-you-update-a-plot-in-julia/22448)._
