# On-the-fly plotting in a script

**URL:** <https://discourse.julialang.org/t/on-the-fly-plotting-in-a-script/84390>\
**Category:** General Usage\
**Tags:** plotting, plots\
**Created:** [July 18, 2022, 9:09am UTC](https://discourse.julialang.org/t/on-the-fly-plotting-in-a-script/84390 "2022-07-18T09:09:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathaniel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathaniel/32/37854_2.png) [@Nathaniel](https://discourse.julialang.org/u/Nathaniel)\
**Post date:** [July 18, 2022, 9:09am UTC](https://discourse.julialang.org/t/on-the-fly-plotting-in-a-script/84390/1 "2022-07-18T09:09:11Z")

</div>

I am writing a julia script and would like to do the following:

1. open a plot window
2. run a few steps of my model
3. update the plot window to show the current status of the model
4. repeat steps 2 and 3 indefinitely

I found a few very old discussions about how to do this in a notebook setting, but nothing about how to do it from a script. Is it possible, and if so what’s the up to date way to do it?

It would be ideal if it can be done efficiently and without flickering, but if that’s not possible I will take any hack that works.

---

<div class="post-metadata">

**Author:** ![Nathaniel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathaniel/32/37854_2.png) [@Nathaniel](https://discourse.julialang.org/u/Nathaniel)\
**Post date:** [July 18, 2022, 9:20am UTC](https://discourse.julialang.org/t/on-the-fly-plotting-in-a-script/84390/2 "2022-07-18T09:20:46Z")

</div>

Never mind, just calling plot() in a loop seems to work just fine. For some reason I expected that to be a lot harder than it is.

It seems it’s best to run the script with `julia -i`, because otherwise ctrl-C causes it to hang, making the process difficult to kill.

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [July 18, 2022, 9:46am UTC](https://discourse.julialang.org/t/on-the-fly-plotting-in-a-script/84390/3 "2022-07-18T09:46:53Z")

</div>

Have a look at `Makie.jl` too for interactively updating plots. Especially [Observables & Interaction](https://makie.juliaplots.org/stable/documentation/nodes/)
