JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
475 stars 87 forks source link

Saving 3D plots #449

Closed avonmoll closed 5 years ago

avonmoll commented 5 years ago

When I create a 3d plot, e.g., surf(rand(30,40)) and try to save (either via the gui window or via savefig) the saved plot is very small with a large whitespace to the right (see below, particularly in a new tab).

Figure_1

I'm not getting anything like this when using matplotlib via python, thus I don't think this is being caused, e.g., by my matplotlibrc.

stevengj commented 5 years ago

Maybe it is due to a different gui backend than in Python? e.g. a causing different default figure size?

Can you try it out with the same Python version as the one used in Julia (PyPlot.PyCall.python)?

avonmoll commented 5 years ago

Yes, using the PyPlot.PyCall.python version (which is the one installed from Julia's Conda, and hence different from my local Anaconda install) yields the same kind of result. Therefore, I set ENV["PYTHON"] = "/path/to/my/anaconda/python/binary" and called Pkg.build("PyCall") and now everything is working as expected (proper figure size, no extra whitespace). I should have suspected/tried this first. I do wonder, in the case where a user has ENV["PYTHON"] = "" (which is apparently the default for Windows and macOS), what is causing the strange whitespace. Note there is no figure size issue for 2D plots. My issue is satisfied by specifying my desired python binary, but other users without a separate python distribution, may run into the same issue.