# How to make this plot interactive?

**URL:** https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379
**Category:** New to Julia
**Tags:** plotting, plots, makie, interactivity
**Created:** [September 18, 2021, 5:10pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379 "2021-09-18T17:10:04Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Bardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bardo/32/21601_2.png) [@Bardo](https://discourse.julialang.org/u/Bardo)
#### Post date: [September 18, 2021, 5:10pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/1 "2021-09-18T17:10:04Z")

</div>

Hi,

The following is NOT a rant about Julia, or just a little bit about its state of documentation.

I am doing the [starter](http://ucidatascienceinitiative.github.io/IntroToJulia/Html/BasicProblems) problems and struggling with the plotting.  
Coming from Matlab… plotting life was easy:

```julia
close all
hold on
for ..
   plot( ..
end
hold off
grid on

```

with interactive mode (zooming, annotating…) in Matlab always on.

Now in Julia. ?plot does not give a hit: you learn that plot is not part of Julia’s Base.  
OK, you have to read a manual. But which one?  
You find Plots.jl, then learn that it is (just) a unifying interface to different backends.  
I installed Plots, took a while to learn that the plotting behavior in a function is different from the REPL: it needs another command to actually show the plot, the command needs a handle. Things I did not find in the intro.

Finally, I got my plot:

```julia
# logistic map
using Plots
n = 100
b = zeros(n)
b[1] = 0.25
plt = plot()
for r in [2.9, 4]
    for i = 2:n
        b[i] = r*b[i-1]*(1 - b[i-1])
    end
    plot!(b)
end
display(plt)

```

But the plot is not interactive. You [learn](http://docs.juliaplots.org/latest/tutorial/#tutorial) that not all backends have an interactive mode.  
How to find out what is the default backend which comes with Plots(?) I guess its GR.  
I tried to use other backends but ran into other difficulties, not all support the plot! (for hold functionality) or did not show up at all.  
[Makie](https://makie.juliaplots.org/stable/) looks very interesting, but apparently is not a backend supported by Plots.  
How do you generate interactive plots?

---

<div class="post-metadata">

### Author: ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)
#### Post date: [September 18, 2021, 6:07pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/2 "2021-09-18T18:07:07Z")

</div>

The Makie documentation contains a [section](https://makie.juliaplots.org/stable/documentation/nodes/) on interactivity but I would suggest starting with the Makie intro docs first.

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [September 18, 2021, 7:23pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/3 "2021-09-18T19:23:40Z")

</div>

The Plots.jl documentation has info about which backend do what, including which support interactivity [Backends · Plots](https://docs.juliaplots.org/latest/backends/)

---

<div class="post-metadata">

### Author: ![Bardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bardo/32/21601_2.png) [@Bardo](https://discourse.julialang.org/u/Bardo)
#### Post date: [September 18, 2021, 8:24pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/4 "2021-09-18T20:24:06Z")

</div>

Yes, I mentioned that in my question above, as well that I get errors.  
Specifically, on Julia 1.7rc and packages updated, with

Pyplot:

```julia
using Plots
pyplot()
default(show = true)
plot(rand(3))
plot!(rand(5))

```

```julia
 Warning: `vendor()` is deprecated, use `BLAS.get_config()` and inspect the output instead
│ caller = npyinitialize() at numpy.jl:67
└ @ PyCall C:\Users\bardo\.julia\packages\PyCall\BD546\src\numpy.jl:67
ERROR: PyError ($(Expr(:escape, :(ccall(#= C:\Users\bardo\.julia\packages\PyCall\BD546\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'AttributeError'>
...

```

Plotly:

```julia
using Plots
plotly()
plot(rand(3))
plot!(rand(5))

```

does not throw an error, plots one plot in the VScode pane, another in the browser.

inspectDR:

```julia
using Plots
inspectdr()
plot(rand(3))
plot!(rand(5))

```

Plots both plots in one VScode pane, but without signs of interactivity, AND in a separate window with a slider for scaling, freezes after a while. Warning message

```julia
(julia.exe:18584): Gtk-WARNING **: 22:17:40.298: Could not load a pixbuf from /org/gtk/libgtk/theme/Adwaita/assets/check-symbolic.svg.
This may indicate that pixbuf loaders or the mime database could not be found.

```

What interactive plotting works for you?

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [September 18, 2021, 8:32pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/5 "2021-09-18T20:32:37Z")

</div>

Plotly.jl and Plotlyjs.jl work fine for me, but also I don’t use VSCode so maybe that’s what’s screwing it up for you? I’ve never tried PyPlot or InspectDR.

---

<div class="post-metadata">

### Author: ![Bardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bardo/32/21601_2.png) [@Bardo](https://discourse.julialang.org/u/Bardo)
#### Post date: [September 18, 2021, 8:44pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/6 "2021-09-18T20:44:29Z")

</div>

Thats possible too, yes, or something to be fixed in the new 1.7.  
I also tried PlotlyJS, et voila it is working!

```julia
using Plots
plotlyjs()
plot(rand(3))
plot!(rand(5))

```

Now 1 out of 4 working, I would not call this a solution.

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [September 18, 2021, 8:45pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/7 "2021-09-18T20:45:59Z")

</div>

Could you uncheck in VS Code settings “Julia: Use Plot Pane”, restart and try again with external plot windows? Using Julia 1.7 and everything seems to be working.

---

<div class="post-metadata">

### Author: ![Bardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bardo/32/21601_2.png) [@Bardo](https://discourse.julialang.org/u/Bardo)
#### Post date: [September 18, 2021, 8:59pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/8 "2021-09-18T20:59:51Z")

</div>

With Julia: Use Plot Pane unchecked and restarted:  
plotlyjs: external window (Electron), interactive  
plotly: in browser, interactive  
pyplot: same vendor/Blas warning, no plot  
inspectdr: own window, said slider (which is x-axis translation), no further useful interactivity.

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [September 18, 2021, 9:01pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/9 "2021-09-18T21:01:07Z")

</div>

> [@Bardo](#):
>
> inspectdr: own window, said slider (which is x-axis translation), no further useful interactivity.

Concerning InspectDR, please take a look at the [keybindings](https://github.com/ma-laforge/InspectDR.jl/blob/master/doc/input_bindings.md#inspectdr-mousekeybindings) section.

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [September 18, 2021, 9:04pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/10 "2021-09-18T21:04:58Z")

</div>

> [@Bardo](#):
>
> pyplot: same vendor/Blas warning, no plot

Concerning the pyplot back-end, the warning is present in my case too but pyplot does work fine. See if [this post helps](https://discourse.julialang.org/t/pyplot-and-conda-problems/59229/2) fixing your installation.

---

<div class="post-metadata">

### Author: ![Bardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bardo/32/21601_2.png) [@Bardo](https://discourse.julialang.org/u/Bardo)
#### Post date: [September 18, 2021, 9:05pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/11 "2021-09-18T21:05:22Z")

</div>

Ok, a key-stroke interface, thx!

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [September 18, 2021, 9:16pm UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/12 "2021-09-18T21:16:46Z")

</div>

> [@Bardo](#):
>
> Now 1 out of 4 working, I would not call this a solution.

We do want you to get to the level 4 out of 4, it looks like you only have now one more to go. Bon courage!

---

<div class="post-metadata">

### Author: ![Bardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bardo/32/21601_2.png) [@Bardo](https://discourse.julialang.org/u/Bardo)
#### Post date: [September 20, 2021, 7:03am UTC](https://discourse.julialang.org/t/how-to-make-this-plot-interactive/68379/13 "2021-09-20T07:03:45Z")

</div>

> [@jzr](#):
>
> The Makie documentation contains a [section](https://makie.juliaplots.org/stable/documentation/nodes/) on interactivity but I would suggest starting with the Makie intro docs first.

GLMakie with my Julia 1.7 is not working reliably. The zoom interaction is e.g. pressing x or y + mouse wheel. Crashes after a while.

```julia
julia> current_figure()
julia> yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyGLFWError (PLATFORM_ERROR): WGL: Failed to make context current: The requested transformation operation is not supported. 
Stacktrace:
 [1] _ErrorCallbackWrapper(code::Int32, description::Cstring)
   @ GLFW C:\Users\xxx\.julia\packages\GLFW\BWxfF\src\callback.jl:43

```
