python matplotlib 绘制图片并保存图片
import matplotlib.pyplot as plt
import numpy as np
def plt_image(tl, x_data, y_data):
plt.clf()
plt.title(tl)
plt.grid(linestyle=":")
plt.plot(x_data, y_data)
plt.subplots_adjust(wspace=0.2, hspace=0.4)
plt.tight_layout()
if __name__ == '__main__':
title = 'title'
x = np.linspace(0, 100, 101)
y = np.linspace(0, 100, 101)
plt_image(title, x, y)
plt.savefig('save.jpg')