gca().set_axis_off()
subplots_adjust(top=1, bottom=0, right=1, left=0, hspace=0, wspace=0)
margins(0, 0)
gca().xaxis.set_major_locator(NullLocator())
gca().yaxis.set_major_locator(NullLocator())
Removing white space around a saved image in matplotlib