# IJulia and magic command

**URL:** <https://discourse.julialang.org/t/ijulia-and-magic-command/37860>\
**Category:** General Usage\
**Tags:** question, plotting\
**Created:** [April 19, 2020, 5:21pm UTC](https://discourse.julialang.org/t/ijulia-and-magic-command/37860 "2020-04-19T17:21:19Z")\
**Posts on this page:** 2\
**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:** [April 19, 2020, 5:21pm UTC](https://discourse.julialang.org/t/ijulia-and-magic-command/37860/1 "2020-04-19T17:21:19Z")

</div>

I would like to use [Jupyter interactive widgets framework, `ipympl`](https://github.com/matplotlib/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](https://github.com/matplotlib/ipympl/blob/master/examples/ipympl.ipynb)

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](https://github.com/stevengj/PyPlot.jl), 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` ).

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 19, 2020, 5:28pm UTC](https://discourse.julialang.org/t/ijulia-and-magic-command/37860/2 "2020-04-19T17:28:15Z")

</div>

> [@Oto\_Brzobohaty](#):
>
> I would like to use [Jupyter interactive widgets framework, `ipympl`](https://github.com/matplotlib/ipympl) with IJulia and PyPlot.

Not supported yet: [Support IPython interactive widgets used in Python code · Issue #89 · JuliaPy/PyCall.jl · GitHub](https://github.com/JuliaPy/PyCall.jl/issues/89)
