How does one replace a curve with another one in a plot?
I have this loop
p = ptrans[1]
pl = plot(vec(distances), vec(p), leg = false, ylims = (-1000, 1000))
for i in eachindex(d["times"])
p = ptrans[i]
pl = plot!(pl, vec(distances), vec(p))
sleep(1)
display(pl)
end
But it simply adds additional curves to the plot instead of replacing the one that is there. I want a single curve which changes as I go through the loop.
I use Plots with gr().