2
votes

So it turns out when you want to use interactive plots (i.e. with zooming, moving around, rotating etc.) in jupyter lab with a python kernel, you need to use %matplotlib widget, this at least works for me. Now the question is: How could I use that feature with a julia kernel? I am a big fan of both matplotlib and julia and I do not want to compromise on them. When I type the above command with a julia kernel, I get the message

The analogue of IPython's %matplotlib in Julia is to use the PyPlot package, which gives a Julia interface to Matplotlib including inline plots in IJulia notebooks. (The equivalent of numpy is already loaded by default in Julia.) Given PyPlot, the analogue of %matplotlib inline is using PyPlot, since PyPlot defaults to inline plots in IJulia. To enable separate GUI windows in PyPlot, analogous to %matplotlib, do using PyPlot; pygui(true). To specify a particular gui backend, analogous to %matplotlib gui, you can either do using PyPlot; pygui(:gui); using PyPlot; pygui(true) (where gui is wx, qt, tk, or gtk), or you can do ENV["MPLBACKEND"]=backend; using PyPlot; pygui(true) (where backend is the name of a Matplotlib backend, like tkagg). For more options, see the PyPlot documentation.

This of course is all true, but it does not mention how interactivity could be achieved. PyPlot works out of the box, but the plots are non-interactive (in the above sense). Any ideas?

1

1 Answers

1
votes

See the PyPlot docs here: https://github.com/JuliaPy/PyPlot.jl for details on setting up interactive plots and such.

This gist may also be of use to you: https://gist.github.com/gizmaa/7214002. I would also suggest looking into Makie.jl for more rich interactive plotting.

Edit: This question may also be relevant to you: Inline Interactive Plots with Julia in jupyter notebook