Skip to content

PyPlot + %matplotlib widget in jupyter lab #505

@volkerkarle

Description

@volkerkarle

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?

Btw, I also posted this question on stackoverflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions