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

Plot displaying - just getting PyObject #337

Open
davidzentlermunro opened this issue Dec 8, 2017 · 6 comments
Open

Plot displaying - just getting PyObject #337

davidzentlermunro opened this issue Dec 8, 2017 · 6 comments

Comments

@davidzentlermunro
Copy link

I'm using julia v0.6.0 in atom v1.22.1. I've installed pyplot after running ENV["PYTHON"]="". If I run:
using PyPlot
plot(1:5,(1:5).^2)
It returns a PyCall.PyObject and address, without displaying. Any ideas?

@c42f
Copy link

c42f commented Mar 12, 2018

I've just encountered this problem on windows 10. It seems to be independent of the python environment; I've tried the interpreter installed automatically by Conda.jl, and also manually installed via the standard anaconda installer in both python2.7 and python 3.6 flavours.

I'm not sure why this is happening yet, but I found a workaround which is to call pygui(true):

using PyPlot
pygui(true)

plot(randn(100))

@c42f
Copy link

c42f commented Mar 12, 2018

Further version information regarding my setup, and a more complete demo:

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.2 (2017-12-13 18:08 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-w64-mingw32

julia> using PyPlot

julia> plot(randn(100))
1-element Array{PyCall.PyObject,1}:
 PyObject <matplotlib.lines.Line2D object at 0x000000002EFFCEB8>

julia> # ^ But no GUI window appears at this point

julia> pygui(true)
true

julia> # Still no plot window

julia> plot(randn(100))
Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use:
    QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors.
    QT_SCREEN_SCALE_FACTORS to set per-screen factors.
    QT_SCALE_FACTOR to set the application global scale factor.
1-element Array{PyCall.PyObject,1}:
 PyObject <matplotlib.lines.Line2D object at 0x0000000030F29C88>

julia> # Plot window magically arrives now!


@c42f
Copy link

c42f commented Mar 12, 2018

Ok, here's why this was happening, at least for me.

Because I'm on windows 10, I've applied the workaround from #334 (comment) in order to pin to the old version 2.3.1.

But in julia-0.6 PyPlot.isdisplayok() from version 2.3.1 doesn't work due to #281.

So pygui(true) is a workaround for this odd combination of versions, I'm not sure it will work for you @davidzentlermunro ?

@c42f
Copy link

c42f commented Mar 12, 2018

Furthermore, having manually installed python 3.6 via anaconda and set ENV["PYTHON"] to the appropriate path, I've been able to Pkg.free("PyPlot") which upgrades PyPlot to 2.3.2, and plotting is now working as expected.

@namelessenko
Copy link

thanks
it helped me, I had the same problem

@stevengj
Copy link
Member

stevengj commented Aug 4, 2022

Probably it just means that PyPlot is not finding a working backend. e.g. look at PyPlot.backend

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

No branches or pull requests

4 participants