here is my code
import matplotlib.pyplot as plt
import numpy as np
fig, (ax1, ax2) = plt.subplots(2,1)
fig.subplots_adjust(hspace=0.5)
data1 = np.loadtxt('val_acc_1.txt')
data2 = np.loadtxt('val_acc_2.txt')
ax1=plt.subplot(2,1,1)
plt.plot(data1[:,0],data1[:,1],'y')
ax1.set_xlim(0,20)
ax1.set_xlabel('epoch')
ax1.set_ylabel('accuarcy')
ax1.set_title('transfer learning')
plt.subplot(2,1,2)
ax2=plt.plot(data2[:,0],data2[:,1],'r')
ax2.set_xlim(0,20)
ax2.set_xlabel('epoch')
ax2.set_ylabel('accuarcy')
ax2.set_title('no transfer learning')
plt.show()
the figure should be like thisenter image description here When I comment out
#ax2.set_xlim(0,20)
#ax2.set_xlabel('epoch')
#ax2.set_ylabel('accuarcy')
#ax2.set_title('no transfer learning')
the code could work partly, and the ERROR still here.
but the ERROR is this enter image description here thank you