I have a strange issue. Using IPython Notebook, I created a quite extensive script using pandas and matplotlib to create a number of charts. When my tinkering was finished,
The font size issues are due to differences in the dpi. I'd guess the slightly different size of the figure (in pixels) changes the "best" location for the legend, as well.
The default dpi a figure is displayed at is 80, while savefig defaults to 100. This means that by default, matplotlib figures will look slightly different when saved compared to what's displayed on the screen.
I don't know for sure, but I'm guessing that ipython notebooks set the dpi to something other than 100 (most likely 80) and use that when saving figures.
Try doing savefig('filename.pdf', dpi=80) in your standalone script.