I want to remove the padding around a figure and save it with exactly specified dimensions:
fig, ax = plt.subplots(figsize=(10,5))
x = [1,2,3]
ax.plot(x, x)
fig.savefig("test.pdf", bbox_inches='tight', pad_inches=0.01)
Unfortunately, doing it this way reduces the dimensions of the resulting figure (in this case to 8.2 in, 4.1 in
). A similar question has been asked here quite a while ago, but does not consider the complete removal of the padding.