The problem is that when you plot dinamically, matplotlib determines the borders automatically to fit all your objects.
When you save a file, things are not being done automagically, so you need to specify
the size of your figure, and then the bounding box of your axes object.
Here is how to correct your code: