The default xmargins and ymargins for matplotlib are 0.05. I wanted to permanently change these to zero.
So I went to the matplotlib rc file (https://matplotlib.org/tutorials/introductory/customizing.html#matplotlibrc-sample) on my PC and changed the axes.xmargin
and axes.ymargin
to 0. I found the path of this file by typing in matplotlib.matplotlib_fname()
.
I typed in print(matplotlib.rcParams["axes.xmargin"])
in to the jupyter notebook and this returns 0.05 so the changes clearly haven't been made. Even when I simply type this in to the command line after loading python the margins haven't changed.
But I've manually changed it. Here is a screenshot of how I edited the file:
As you can see, the axes are both set to zero.
I have typed conda install matplotlib
in to the command line to see if this would change anything, but nothing's changed.