# Update existing plot instead of showing a new one

**URL:** https://discourse.julialang.org/t/update-existing-plot-instead-of-showing-a-new-one/31630
**Category:** Visualization
**Created:** [November 28, 2019, 4:43pm UTC](https://discourse.julialang.org/t/update-existing-plot-instead-of-showing-a-new-one/31630 "2019-11-28T16:43:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![maximilianpreisinger](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@maximilianpreisinger](https://discourse.julialang.org/u/maximilianpreisinger)
#### Post date: [November 28, 2019, 4:43pm UTC](https://discourse.julialang.org/t/update-existing-plot-instead-of-showing-a-new-one/31630/1 "2019-11-28T16:43:41Z")

</div>

Hi guys,

the whole plotting stuff very confuses me. For example I manage to display my plot with Plots.jl with the plotlyjs backend (it opens a new browser tab and shows my plot), and I am happy with it. However I do not understand, how exactly it works and what exactly causes the browser to open and to connect it with my plot. Because I do not understand, how it works, I do very hard modifying things the way I would like them to work.

This is my code so far, and it is working:

```julia
# Julia 1.2, using Visual Studio Code on Ubuntu

using Plots
plotly();

# x, y and l defined somewhere else...

p=plot(x[1],y[1]; label=l[1], size=(500,250), dpi=300)
display(p)
for i=2:10
    plot!(x[i],y[i]; label=l[i])
end
display(p)

```

You see that I have the `display` function twice. Now I would like that when I modify the plot somehow (for example with `plot!`), that the plot updates **in the same window**. However, everytime I call `display`, my browser opens a **new** page called `file:///tmp/jl_XXXXXX.html`.  
I don’t know why this file is created in the first place, and how the plot is forwarded to this file.

Is it possible to create a well defined file, open it in my browser automatically, and to modify and reload that page whenever I need to? Also, If someone could explain me how display exactly works, I would be glad.

---

<div class="post-metadata">

### Author: ![maximilianpreisinger](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@maximilianpreisinger](https://discourse.julialang.org/u/maximilianpreisinger)
#### Post date: [November 29, 2019, 9:53am UTC](https://discourse.julialang.org/t/update-existing-plot-instead-of-showing-a-new-one/31630/2 "2019-11-29T09:53:12Z")

</div>

Hm, I just figured out, there is a `overwrite_figure` keyword. But even when I set this to `overwrite_figure=true` inside the `plot` function, every call to `display` will create a new temporary file and open a new tab in my browser. Seems this keyword does not work in this constellation. Is there another way to get it to override the current plot? Is this expected behaviour or is this a bug?
