How do you make zoomable inline plot with PyPlot.jl?


It seems, that according to PyPlot.jl documentation, you have only two options:

  1. You make the plots inline, but you can not interact with them, no zoom etc.
  2. You make the plots in separate GUI windows, then you gain access to this functionality.

Is it possible to get zoomable inline plots, analogous to what you get with “%matplotlib notebook” for python?


If someone is interested.
I found that my question is essentially equivalent to “how do you make matplotlib’s nbagg backend work with IJulia”.
There is even an opened issue about it: JuliaPy/PyPlot.jl#137. It is dated back to 2015, and there was no progress since then.
It seems the problem can be solved if one replaces python’s CommSocket class with another one, created via PyCall’s @pydef and rerouting communication to IJulia kernel (see the last comment in the issue thread). I could try to do it.

Could someone, who knows PyCall, help me with two questions:

  1. Can you @pydef a python class with references to Julia objects and Julia functions?
  2. There is FigureManagerNbAgg class, which creates instances of CommSocket. In order for everything to work, I should overhaul the corresponding class method, where it happens, to instanciate my new @pydef-ed
    class. How should I approach this? (I can think about replacing PyObject’s Dictionary field: PyClass[:somemethod] = new_julia_function. But will this actually work?)