在plt.show()之前执行plt.savefig()函数即可。

简单例子:

import matplotlib.pyplot as plt

x=[1,2,3,4,5]

y=[10,5,15,10,20]

plt.plot(x,y,'ro-',color='blue')

plt.savefig('testblueline.jpg')

plt.show()

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-02-01
  • 2021-12-28
  • 2021-10-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2021-10-03
相关资源
相似解决方案