Similar questions have been asked before, but all of my search results don\'t address my problem. Take the following example code:
from matplotlib.pyplot i
matplotlib 1.1.1 has added figure.tight_layout() (doc) that will do this for you.
figure.tight_layout()