Final. Bug was fixed by not commenting out plt.show()