Description
I have found that in the rc2 version of matplotlib that there is extra padding when using plt.tight_layout(pad=0)
for axis labels. It also is worse for when using usetex=True
for the axis label.
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['xtick.direction'] = 'in'
matplotlib.rcParams['ytick.direction'] = 'in'
matplotlib.rcParams['xtick.top'] = True
matplotlib.rcParams['ytick.right'] = True
fig = plt.figure(figsize=(3,4))
plt.xticks([0.2,0.8])
plt.yticks([0.2,0.8])
plt.xlabel('x label')
plt.ylabel('y label', usetex=True)
plt.tight_layout(pad=0)
fig.savefig('test.png', dpi=1000)
I ran the above code twice, once in 1.5.1 and again in 2.0.0rc2 (for 1.5.1 you must comment out matplotlib.rcParams['xtick.top'] = True
and matplotlib.rcParams['ytick.top'] = True
). The screenshot below shows the saved png for 1.5.1 on the left and 2.0.0rc2 on the right:
In 1.5.1 you can see that the text for both the "y label" and "x label" are right next to the edge of the figure. However in 2.0.0rc2 the x and y labels are significantly spaced from the edge of the figure and the spacing is even worse for the y label where usetex=True
.
I am using Python 2.7 installed on Windows from anaconda.