Try doing all plotting and writing to text boxes etc. after every 10,000 iterations (instead of every iteration) and your program should show significant speed improvement.