Skip to content

Don't try to re-setup any GUI event loop (for PyJulia)#383

Open
tkf wants to merge 1 commit intoJuliaPy:masterfrom
tkf:pyjulia
Open

Don't try to re-setup any GUI event loop (for PyJulia)#383
tkf wants to merge 1 commit intoJuliaPy:masterfrom
tkf:pyjulia

Conversation

@tkf
Copy link
Member

@tkf tkf commented Aug 31, 2018

If matplotlib.pyplot exists, it means that matplotlib backend is already configured. It may mean that PyPlot.jl is called via PyJulia. Don't setup any GUI event loop in this case since matplotlib does not support switching GUI backends.

With this patch, %julia magic can show interactive notebook plots:

image

@tkf
Copy link
Member Author

tkf commented Aug 31, 2018

Maybe it's better to not switch only from "unknown" backend (e.g., nbagg)?

    if haskey(matplotlib, :pyplot)
        # If matplotlib.pyplot exists, it means that matplotlib
        # backend is already configured.  It may mean that PyPlot.jl
        # is called via PyJulia.
        backend = lowercase(matplotlib[:get_backend]())
        if !haskey(matplotlib2gui, backend)
            return (backend, :none)
        end
    end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant