gcalderone/Gnuplot.jl

Support for VSCode's Julia plugin's Plot Pane

VarLad opened this issue · 3 comments

As you might know, the updates of Juno have been discontinued, the developer is helping with the Julia plugin on VSCode. Can plotting in VSCode's Julia plugin's plot pane be supported in Gnuplot.jl, like in Juno?Its not working as of now.
I'll be trying it out in Pluto.jl soon too.

At least, this works.

using Gnuplot

gp = @gp "plot sin(x)"
file = tempname() * ".png"
save(gp.sid, term="pngcairo enhanced", output=file)
display(VSCodeServer.InlineDisplay(), MIME("image/png"), read(file))

Its... not very convenient, but gets the job done. I can make this a function and it'll become easier instead of writing that every time I want to plot.
Thanks a lot.
Regarding the function, I'd recommend @gcalderone to make it a function in the Gnuplot.jl package too.

Currently, it is sufficient to run

Gnuplot.options.gpviewer = false

and VSCode shows the plots. Unfortunately, the plot is very small, but this can be fixed by running:

Gnuplot.options.mime[MIME{Symbol("image/svg+xml")}] = "svg enhanced"

The default is svg enhanced mouse standalone dynamic background rgb 'white' and the part that needs to be removed is dynamic. This option should make the plot to scale dynamically in the viewer, but it somehow doesn't work under VSCode.