作者:Lyj眼淚啲菋噵 | 来源:互联网 | 2023-02-03 13:45
1> 小智..:
原始问题的答案很简单。如果您不想在屏幕上显示图形,请不要使用。plt.show()
因此,您要做的只是:
import matplotlib.pylab as plt
plt.plot(x,y) #whatever the x, y data be
#plt.show() """Important: either comment this line or delete it"""
plt.savefig('path/where/you/want/to/save/filename.ext')
#'filename' is either a new file or an already existing one which will get overwritten at the time of execution. 'ext' can be any valid image format including jpg, png, pdf, etc.