By default, it is always saved in the same folder as the py file. How can I change the path and save the generated image on the path I want?
PHPz2017-05-18 10:47:14
In matplotlib, pyplot does not have a save function. If you want to save a picture, you can refer to the following simple example:
>>> from matplotlib import pyplot as plt
>>> x=[2,5]
>>> y=[4,9]
>>> plt.plot(x,y)
>>> plt.savefig('D:\img.jpg')
Of course you can also save it in PDF format:
>>> plt.savefig('D:\img.pdf')
matplotlib will handle this part of the work automatically.