I would like to use Jupyter interactive widgets framework, ipympl
with IJulia and PyPlot.
I installed ipympl using pip3 install ipympl and then I tested it in the Jupyter notebook with python kernel using this simple example
Here is essential to use the so called iPython magic command
%matplotlib widget
Everything was fine and I got interactive plot with pan/zoom.
My question is how do I insert this magic command into IJulia notebook?
I got this help from IJulia:
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 ofnumpy
is already loaded by default in Julia.)
Given PyPlot, the analogue of%matplotlib inline
isusing PyPlot
, since PyPlot defaults to inline plots in IJulia.To enable separate GUI windows in PyPlot, analogous to
%matplotlib
, dousing PyPlot; pygui(true)
. To specify a particular gui backend, analogous to%matplotlib gui
, you can either dousing PyPlot; pygui(:gui); using PyPlot; pygui(true)
(wheregui
iswx
,qt
,tk
, orgtk
), or you can doENV["MPLBACKEND"]=backend; using PyPlot; pygui(true)
(wherebackend
is the name of a Matplotlib backend, liketkagg
).