Is there a way to switch between inline and interactive mode with IJulia and PyPlot?

Basically I’m working in Jupyter notebook and occasionally I want to pop out a plot into its own window to make it interactive (otherwise inline by default is OK). Is this possible?

You can toggle this behaviour inside jupyter before plotting:

PyPlot.pygui(true)

You’ve also got to have the current jupyter kernel running on your local machine for this to work.

1 Like

Ah nice, thanks!

Is there something similar for when using Plots + pyplot() ?

It may also work to just use PyPlot.pygui() if you’re using the pyplot backend?

Thanks @Chris_Foster, but I already tried it and I get the following message:

PyPlot.pygui(true)

ArgumentError: invalid gui none

Stacktrace:
 [1] pygui(::Symbol) at /home/davide/.julia/packages/PyCall/ttONZ/src/gui.jl:59
 [2] pygui_start(::Symbol, ::Float64) at /home/davide/.julia/packages/PyCall/ttONZ/src/gui.jl:222 (repeats 2 times)
 [3] pygui(::Bool) at /home/davide/.julia/packages/PyPlot/4wzW1/src/init.jl:224
 [4] top-level scope at In[11]:1


Looks like we’ve tried the obvious things then (I also tried calling pygui before loading Plots). It may be a source-reading exercise to figure out if there’s a way to do this.

The two libraries do trigger the actual plotting quite differently; Plots is more functional in nature (plots being show by displaying the value of the cell) and PyPlot quite imperative.

I am experiencing the same problem. Have you solved it?

No, but never tried any more.