I was trying to get dynamic figures in jupyter notebook. After searching the answers on stackexchange and testing, I find that changing plt.draw to fig.canvas.draw allowed the f