PyPlot.jl icon indicating copy to clipboard operation
PyPlot.jl copied to clipboard

Empty window pops up when plotting

Open Keno opened this issue 11 years ago • 11 comments

On @JeffBezanson's computer, whenever he makes a new plot with PyPlot, an empty window pops up.

Keno avatar Jan 21 '14 19:01 Keno

PyPlot.backend gives "Qt4Agg".

JeffBezanson avatar Jan 21 '14 20:01 JeffBezanson

Is this in IJulia, or in the terminal?

stevengj avatar Jan 21 '14 20:01 stevengj

In the notebook. The plot actually does show up.

Keno avatar Jan 21 '14 20:01 Keno

Weird, I can't reproduce on my Mac. What OS?

stevengj avatar Jan 21 '14 20:01 stevengj

Ubuntu I believe.

Keno avatar Jan 21 '14 20:01 Keno

Does it work if you do

using PyCall
pygui(:gtk)
using PyPlot

?

stevengj avatar Jan 21 '14 21:01 stevengj

Yes! That gets rid of the empty windows.

JeffBezanson avatar Jan 21 '14 21:01 JeffBezanson

(Maybe I should use a PYCALL_GUI environment variable so that you can save this preference.)

@fperez, what backend does IPython default to for matplotlib on Linux distros?

stevengj avatar Jan 21 '14 21:01 stevengj

I don't recall out of the box... It used to be GTK, I think (as that was the first one @jdh2358 wrote). @mdboom, do you know if that has changed recently?

fperez avatar Jan 22 '14 02:01 fperez

As of matplotlib 1.3.0, the default backend was changed to Qt4. More specifically, it sets the default backend to the first one that works in a list in this order:

    setupext.BackendMacOSX(),
    setupext.BackendQt4(),
    setupext.BackendGtk3Agg(),
    setupext.BackendGtk3Cairo(),
    setupext.BackendGtkAgg(),
    setupext.BackendTkAgg(),
    setupext.BackendWxAgg(),
    setupext.BackendGtk(),
    setupext.BackendAgg(),
    setupext.BackendCairo(),
    setupext.Windowing(),

mdboom avatar Jan 22 '14 14:01 mdboom

@mdboom, is there something special you need to do to keep windows from popping up on Linux for inline plotting? We are initializing matplotlib with the Qt4Agg backend and just using switch_backend to switch to an Agg backend for inline plots, so that people can switch to Qt4 plotting at runtime if they wish. On MacOS and Windows, that seems to be enough to suppress plot windows.

(And why do you use Qt4 rather than Qt4Agg?)

stevengj avatar Jan 22 '14 16:01 stevengj