Assuming you imported matplotlib.pyplot as plt, try plt.ion() at the start of your code.  This enables interactive plotting.  If this does not work, you may need to change your backend, See the matplotlib FAQ for details on this question.