I have a batch of charts which need to be created using a standard template. The problem is that the number of digits in the Y-axis varies from set to set; this is causing a problem as I can’t seem to get the layout to accomdate a ylabel + the digits without clipping.
Is there any suggestion of how to choose correct values for subplot_adjust, or make tight_layout keep the suptitle in mind?
Code currently looks approximately like this:
rc('text',usetex=True)
rc('font',family='serif')
mpl.rcParams.update({'font.size': 22})
fig = plt.figure(1,dpi=300,figsize=(4,4))
fig.suptitle(b.replace("_","-"))
ax = fig.add_subplot(1,1,1)
lx = 0
for i in instances:
lx = max([lx,len(X[i])])
plt.plot(X[i],Y[i])
plt.xlabel("X Label")
plt.ylabel("Y Label")
fig.subplots_adjust(bottom=0.1, top=0.9) # Works for some charts, not others!
plt.savefig(b+".pdf",format="pdf")
Docs