There is no shortage of SO questions about saving a matplotlib figure to a file. This is easy using fig.savefig(filename).
But what if I want to save only the plot area itself, not the x- and y-axes, the outline of the plot or the title etc.
For example, I would like to export only the area shown in red below to either a .pdf or a .png:

fig.subplots_adjust(left=0,right=1,bottom=0,top=1)before you savefig? then you will lose all the titles, labels, etc.