Question:
How can I get a plots pane and not in “GKS QtTerm” (not sure what GKS or QtTerm are)?
How can I get a plots pane and not in “GKS QtTerm” (not sure what GKS or QtTerm are)?
I have the same exact problem.
Please check in VS Code settings the “Display plots within vscode” option and restart Julia.
Thanks for calling this setting to my attention. I wasn’t aware of its existence. The text is:
Julia: Use Plots Pane
Display Plots within VSCode. Might require a restart of the Julia process.
I tried it and it did not work. I even rebooted my PC to make sure I was in a new Julia session. The setting does not seem to have any effect on whether the chart appears in the Plots Pane. There must be something blocking VSCode from doing that.
Please post a minimum (non) working example (MWE).
This is the best I could do, nine lines of code in two files.
The environment is BootWalk
.
Main file, TestPlots.jl
:
cd("C:/Dropbox/Code/Julia/bootstrapwalkforward/BootWalk/src")
include("./PlotsOnAnotherModule.jl")
Module file: PlotsOnAnotherModule.jl
:
module PlotsOnAnotherModule
import Plots
function foo()
p = Plots.plot!([1.0, 2, 3, 4, 6, 8, 10], show = true)
end
foo() # This is the call that creates the plot
end
Both files are in C:/Dropbox/Code/Julia/bootstrapwalkforward/BootWalk/src
.
To reproduce the problem:
Close the existing REPL, if any, by clicking on the garbage can on the top right of its window.
Open a new REPL with Alt+J Alt+O
.
Select file TestPlots.jl
.
Hit Ctrl+A
to select all the code. Alternatively go to the bottom of the file and hit Ctrl+Shift+Home
.
Hit Ctrl+Enter
to execute the selected code in the REPL. (It may be a different key combination in other systems).
What will happen:
After a while the GKS QtTerm
window will pop up and will stay up even after the code is all executed. No plot will appear in the Julia Plots pane. If there were already plots on the Julia Plot pane the number of plots on the tab will not increase.
Adjusting the VS Code plot settings as indicated above and then adding to TestPlots.jl:
PlotsOnAnotherModule.foo()
does get the plot displayed in the VS Code plot pane.
show = true
seems weird. I’d recommend explicitly using display
instead.
This will work. But that is not what I want to do. I want the plot to be generated from within a function that is within a module.
It worked. Terrific! Many thanks. Still only works from the REPL, not if I hit Ctrl+F5. But I guess that is the way it is supposed to be, at least for now.
Yeah, that’s to be expected atm. The plot pane isn’t hooked up to the Run in new process
functionality.
This problem is back.
Julia 1.8.1
Linux (PopOS 22.04)
Visual Studio Code 1.71.1
Anyone know how to fix it?
Problem has resolved with a restart. No idea why…
Yes. I have a same problem