Makie only working properly in REPL

I’m using:
vscode 1.59.1
Julia Language Support 1.3.33
Julia 1.6.1
Windows 10
GLMakie 0.4.6 (among many others)

I have code that retrieves data out of a SQLite db and displays in a simple series plot. When I either step through the file executing each line using ctrl+enter or selecting the whole file and using Alt+Enter, the plot shows just fine.

Here is a bit of the code…
fig = Figure(resolution=(1200,1800))
sc = display(fig)
Notifications_ax = Axis(fig[1,1])
series!(Notifications_ax,InfectionCount’)
Notifications_ax.yticks = 0:1:20
Notifications_ax.title =string("Covid Cases for “,lga,” between “,startdate,” and ", enddate)
Notifications_ax.xlabel = “Days”
Notifications_ax.ylabel = “Number of cases”

However when I try and run the file using wither F5 or ctrl+F5 a white Makie window appears, stays blank for a minute then closes without ever showing the plot. This behavior is repeatable, even after restarting vscode.

Can anyone point me in a direction that might get me to the bottom of this? Could this be related to bad code or perhaps incompatibilities between packages?

Thanks
Steve

If you run a file in VSCode, I think a new julia process is opened and the code run until it’s done and the julia process exits. When your code is done, the Makie window will just close again because there’s nothing keeping the process running and the window open. I guess there should be some kind of option to run a file such that afterwards it goes into interactive Repl mode. Or you include your code file from the repl instead of using the run file option from vscode.

Yeah, make sure you select the Julia: Execute active File in REPL option, not Julia: Run File in New Process:
image

IIRC F5 defaults to the “new process” option.

Alternatively, just add a readline() call to the end of your file so the process stays alive until you hit enter in the terminal.

Thanks jules, seb. Both worked and I’m starting to understand the execution paradigm, Should there be any performance difference between these two methods?

Steve

No, only if you start a new process every time, you pay for compilation again and again so it’s better to avoid that

You can also use one of the “execute code cell” commands.
If you didn’t mark any cells boundaries (a line starting with ##), the whole file is one cell, so it’s executed in the REPL.