Save image using matplotlib.pyplot
This is a very simple question, but I must be misunderstanding the use of a pistol and a figure or whatever. I am drawing some images and would like to save them, not just show them and save them manually. So far I have tried:
import matplotlib.pyplot as plt
fig = plt.figure()
plt.plot(d,c1[0:100],'b--',d,c2[0:100],'r--',d,c3[0:100],'g--',figure = fig)
plt.ylabel("concentration")
plt.xlabel("distance")
plt.show()
plt.savefig('./Results/evol_conc_v'+str(vinit)+'a_'+str(a)+'.png')
The generated file is empty, but the image was good. An existing similar question doesn't seem to apply.
+3
source to share