Added kludge to work around an idiotic decision by the matplotlib team to make the interactive plot behaviour perform differently in scripts and on the command line.
Affects matplotlib v1.4 hopefully they will reverse this behaviour asap.