From http://eli.thegreenplace.net/files/prog_code/wx_mpl_dynamic_graph.py.txt