Skip to content

Need %matplotlib inline twice when running via Python #472

@marius311

Description

@marius311

I wasn't sure whether to file here or in pyjulia, please feel free to transfer if this was the wrong choice.

Basically, from a fresh Python Jupyter kernel if I execute the following (each line in a separate cell):

%matplotlib inline
from julia.PyPlot import plot
plot([1,2,3])

then no inline plot is shown. I have to execute %matplotlib inline one more time before inline plots start showing. This does not happen if I replace from julia.PyPlot import plot with from matplotlib.pyplot import plot, not does it happen when plotting from a Julia kernel.

I have Julia 1.4, pyjulia 0.5.0, matplotlib 3.1.1, IJulia v1.21.1, PyPlot v2.8.2.

I found these Issues which seem could be related:

jupyter/notebook#3691
ipython/ipython#11916

If you're wondering why I'm not calling Python plot directly, its because Julia's version of plot can be (and is, in my case) specialized on the argument types. Interactively its no big deal to run it twice, but this is happening in some automatic documentation generation, where its slightly ugly to have the %matplotlib magic in there twice to make this work.

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