import matplotlib.pyplot as plt accuracy_0_list = [] accuracy_1_list = [] with open('vision/text-loss-0', 'r') as fp0: accuracy0 = fp0.readline().replace('\n', '') while accuracy0: accuracy_0_list.append(float(accuracy0)) accuracy0 = fp0.readline().replace('\n', '') with open('vision/text-loss-1', 'r') as fp1: accuracy1 = fp1.readline().replace('\n', '') while accuracy1: accuracy_1_list.append(float(accuracy1)) accuracy1 = fp1.readline().replace('\n', '') step_0_list = [i for i in range(len(accuracy_0_list))] step_1_list = [j for j in range(len(accuracy_1_list))] plt.subplot(2,2,1) plt.plot(step_0_list, accuracy_0_list, 'o-',label='loss-0', color='red') plt.plot(step_1_list, accuracy_1_list, 'o-', label='loss', color='green') plt.xlabel("step") plt.ylabel("test-loss") plt.legend(loc='lower right') plt.subplot(2,2,2) plt.plot(step_0_list, accuracy_0_list,'o-', label='loss-0', color='red') plt.xlabel("step") plt.ylabel("test-loss") plt.legend(loc='lower right') plt.subplot(2,2,3) plt.plot(step_1_list, accuracy_1_list, 'o-', label='loss-1', color='green') plt.xlabel("step") plt.ylabel("test-loss") plt.legend(loc='lower right') plt.show()