Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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