# Why the plotCurve3D didn't show up while the code finished running?

**URL:** <https://discourse.julialang.org/t/why-the-plotcurve3d-didnt-show-up-while-the-code-finished-running/125476>\
**Category:** General Usage\
**Created:** [February 2, 2025, 3:45pm UTC](https://discourse.julialang.org/t/why-the-plotcurve3d-didnt-show-up-while-the-code-finished-running/125476 "2025-02-02T15:45:26Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)\
**Post date:** [February 3, 2025, 8:36am UTC](https://discourse.julialang.org/t/why-the-plotcurve3d-didnt-show-up-while-the-code-finished-running/125476/4 "2025-02-03T08:36:41Z")

</div>

This all depends on exactly how you run your script. It seems like you’re using something akin to `julia script.jl`. In that case Julia will go through your script and terminate after having executed the last line. Because the plotting window runs asynchronously (in contrast to `sleep`), Julia will open the window, but immediately move on to the next line. When Julia soon after reaches the end of the script and terminates, the plotting window also closes.

If you run your script in interactive mode via `julia -i script.jl`, Julia will not close and you can keep interacting with the plot. Alternatively, you can use `include("script.jl")` into an active REPL. Within VS Code you have _Julia: Execute (Active) File in REPL_.

As a sidenote, I would have expected there to be a `plot(..., block=true)` option, as in Python’s matplotlib, but that doesn’t seem to be the case. This would halt Julia at the plotting code line, so that we don’t reach the end and exit. You could then also use `@spawn`/`@async` `display(plot(..., block=true))` and `wait` at the end of the script to wait there until the window has been closed. But again, no `block` keyword seems to exist. A ‘workaround’ I’ve seen [suggested](https://discourse.julialang.org/t/how-do-i-wait-for-a-plots-jl-window-to-be-closed/80122/2) is to use `readline()` to block the main (IO) thread.

---

_[View the full topic](https://discourse.julialang.org/t/why-the-plotcurve3d-didnt-show-up-while-the-code-finished-running/125476)._
