Closed Datseris closed 7 years ago
The function tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
also has no impact on my figure.
Doing: f[:tight_layout](pad=0.4, w_pad=0.1, h_pad=1.0)
also has no impact on my figure.
Doing: f[:subplots_adjust](hspace = 0.01)
also does nothing.
What happens if you try the equivalent code in Python?
I have no idea actually. I opened spyder but I could not make it work. plt.figure()
could not produce a figure for the love of it, even if the console said that an object was created.
I've used all the combinations of pylab.show()
, draw, etc. and the same from pyplot with show and interactive mode on, but I could not have a figure window appear no matter what.
Since I haven't used Python in over a year and I won't be using it in the future, I did not bother fixing it...
But does what I reported here work for you or not?
They work fine for me (Julia 0.6, with the Conda.jl Python installation on MacOS), both as inline plots in IJulia and in a qt5agg backend window. Without the subplots_adjust
lines, I get:
and with the subplots_adjust
lines I get:
So, I'm guessing that this is a problem with Matplotlib on your machine.
When there is a plotting glitch like this, I generally ask people to try it in Python to see whether the problem is in Matplotlib itself or in their Python installation.
If you don't want to maintain a working Python installation, especially on Windows or Mac, I highly recommend that you let Julia manage its own Python installation via Conda. Do
ENV["PYTHON"]=""
using Conda
Conda.update()
Pkg.build("PyCall")
to make sure that PyCall is configured using Conda and that Conda is up-to-date.
Thank you. I will do that then. Would you be so kind to tell where does Conda store the matplotlibrc file? I always change the default settings.
Matplotlib will tell you this: just do PyPlot.matplotlib[:matplotlib_fname]()
Actually, matplotlib_fname
tells you the location of the currently active matplotlibrc. If you haven't installed your own, this will be the one packaged with Conda (in site-packages/matplotlib/mpl-data/matplotlibrc
), but you don't want to edit that one because it will get overwritten when Conda is updated. Instead, you want to copy it to $HOME/.matplotlib/matplotlibrc
and edit it there, where $HOME
is your home directory (homedir()
in Julia).
This is all described in the matplotlib docs: https://matplotlib.org/users/customizing.html#customizing-with-matplotlibrc-files
Thank you, everything works fine now.
I also finally understood what the problem was!!! In the matplotlibrc file there is some configuration under FIGURE:
#figure.autolayout : False
which I have set to True
making almost every positional change impossible!
Irrespectively of the numbers given to
subplots_adjust
, nothing happens.