# ##############----- 函数:常规绘图: -----#############
def plot(r, ylabel):
import numpy as np
import matplotlib.pyplot as plt
plt.plot(np.arange(len(r)), r, linewidth=1)
# 长度len(r) 信号:r
plt.ylabel(str(ylabel))
plt.xlabel('training episodes')
plt.title('title')
plt.savefig("./"+ylabel+".png")
plt.show()
if __name__ == "__main__":
returnList = [1, 3, 5, 7, 9]
ylabel = 'A figure save'
plot(returnList, ylabel)
绘制图片并且保存图片(Python)
于 2023-12-01 19:50:14 首次发布