GR interactivity in Pluto

I have found this post

I have downloaded the example notebook pluto_ex.jl

But I got this error

UndefVarError: init_pluto not defined

in this cell

begin
	ENV["GRDISPLAY"] = "pluto"
	using GR
	GR.js.init_pluto()
end
1 Like

I can’t help with that error but I will point out that Plotly interactivity (panning, zooming, etc.) does work within Pluto and in exported html files from Pluto. I use it is as follows:

begin
    using Plots
    plotly()
end
1 Like

Which GR run-time version are you using? Please try to update and rebuild GR:

ENV["GRDIR"] = ""
] build GR
3 Likes

Not sure if it’s just a different manifestation of the same error reported by the OP, but what I get is a popup:

I did try the suggestion above to rebuild GR.

GR is the default plotting backend for Plots.jl and this works fine in Pluto for me.
Plus I can switch to Plotly if interactivity is needed.

Is there any advantage to use GR.jl directly, e.g. functionality not available over Plots.jl?

1 Like

GR v0.51.0

after GR rebuild the error is still there

Support for Pluto was introduced in GR 0.51.2. Please update GR to 0.52.0 …

1 Like

GRUtils hold my GR version back.

Now I have 0.52.0 version. Unfortunately, I have now this error:

JSTerm (GR) not initialized. Run GR.js.init_pluto() at the end of a codecell

That’s strange. When I downgrade Pluto to v0.11.14 ( ] add Pluto#v0.11.14 ) it works. There must be something different in v0.12.4. We have to checks this …

@fonsp: Any idea where to start?

https://github.com/jheinen/GR.jl/blob/master/examples/pluto_ex.jl

Hi, this should be already solved.

1 Like

The problem should be fixed in GR#master. Thanks to @mteser.

1 Like

Good to hear! @jheinen would you like to call sometime about further Plots.jl + pluto integration? fonsvdplas@gmail.com

3 Likes

Thanks for the fix. Any chance to get it working in VS Code plot pane?

1 Like

does this still work? I just get a static image

Yes - it works. It’s important to set the GRDISPLAY environment before importing GR:

ENV["GRDISPLAY"] = "pluto"
using GR