I'm having a serious issue with pyplot not displaying my figure until the end of my code. The code below is a simplest example I can think of, and recreates the problem for me. When plt.plot(range(10)) is called an unresponsive and empty figure window open, but at the end of the code (after the sleep) the graph is displayed. The time is a placeholder for a while(True) loop that is supposed to read from a seriel device and update the graph, which is impossible as I cannot force the graph to draw before the end of code.
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import time
plt.plot(range(10))
#plt.show()
plt.draw()
# while loop for computations, simulated by a sleep command
time.sleep(2)
I am at my wits end. Using backend Qt4Agg. Operating system is windows 7, and am using python 2.7.