# GR interactivity in Pluto

**URL:** https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906
**Category:** General Usage
**Tags:** plotting, gr, pluto
**Created:** [October 23, 2020, 7:40pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906 "2020-10-23T19:40:48Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)
#### Post date: [October 23, 2020, 7:40pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/1 "2020-10-23T19:40:48Z")

</div>

I have found this post

> <https://twitter.com/josef_heinen/status/1308733083101925381>

I have downloaded the example notebook pluto\_ex.jl

> <https://github.com/jheinen/GR.jl/tree/master/examples>
>
> //github.com/jheinen/GR.jl/tree/master/examples

But I got this error

> UndefVarError: init\_pluto not defined

in this cell

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

```

---

<div class="post-metadata">

### Author: ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)
#### Post date: [October 23, 2020, 9:19pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/2 "2020-10-23T21:19:06Z")

</div>

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:

```julia
begin
    using Plots
    plotly()
end

```

---

<div class="post-metadata">

### Author: ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)
#### Post date: [October 23, 2020, 9:29pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/3 "2020-10-23T21:29:55Z")

</div>

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

```julia
ENV["GRDIR"] = ""
] build GR

```

---

<div class="post-metadata">

### Author: ![airpmb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/airpmb/32/7826_2.png) [@airpmb](https://discourse.julialang.org/u/airpmb)
#### Post date: [October 24, 2020, 1:05am UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/4 "2020-10-24T01:05:31Z")

</div>

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

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/5/453115693da01ebe47b1c38d7b636657bfdb25d1.png)

I did try the suggestion above to rebuild GR.

---

<div class="post-metadata">

### Author: ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)
#### Post date: [October 24, 2020, 6:58am UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/5 "2020-10-24T06:58:08Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)
#### Post date: [October 24, 2020, 8:07am UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/6 "2020-10-24T08:07:30Z")

</div>

> [@jheinen](#):
>
> `build GR`

GR v0.51.0

after GR rebuild the error is still there

---

<div class="post-metadata">

### Author: ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)
#### Post date: [October 24, 2020, 4:38pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/7 "2020-10-24T16:38:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)
#### Post date: [October 24, 2020, 5:15pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/8 "2020-10-24T17:15:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)
#### Post date: [October 25, 2020, 6:56am UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/9 "2020-10-25T06:56:46Z")

</div>

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](https://github.com/jheinen/GR.jl/blob/master/examples/pluto_ex.jl)

---

<div class="post-metadata">

### Author: ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)
#### Post date: [October 25, 2020, 6:41pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/10 "2020-10-25T18:41:39Z")

</div>

> [@Oto\_Brzobohaty](#):
>
> GRUtils hold my GR version back.

Hi, this should be already solved.

---

<div class="post-metadata">

### Author: ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)
#### Post date: [October 27, 2020, 10:05pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/11 "2020-10-27T22:05:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)
#### Post date: [October 28, 2020, 7:08am UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/12 "2020-10-28T07:08:52Z")

</div>

Good to hear! @jheinen would you like to call sometime about further Plots.jl + pluto integration? [fonsvdplas@gmail.com](mailto:fonsvdplas@gmail.com)

---

<div class="post-metadata">

### Author: ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)
#### Post date: [October 28, 2020, 9:54am UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/13 "2020-10-28T09:54:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![AshtonSBradley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashtonsbradley/32/11140_2.png) [@AshtonSBradley](https://discourse.julialang.org/u/AshtonSBradley)
#### Post date: [August 15, 2023, 9:38pm UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/14 "2023-08-15T21:38:05Z")

</div>

does this still work? I just get a static image

---

<div class="post-metadata">

### Author: ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)
#### Post date: [August 16, 2023, 6:04am UTC](https://discourse.julialang.org/t/gr-interactivity-in-pluto/48906/15 "2023-08-16T06:04:12Z")

</div>

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

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

```
