Starting at line 363:
console.execute_line('import matplotlib')
console.execute_line("matplotlib.use('GTKAgg')") # or 'GTK'. This is the only change
console.execute_line('matplotlib.interactive(1)')
console.execute_line('from matplotlib.matlab import *')
Otherwise, an incompatible backend will cause the plot window to hang.
Darren