Here is my plot function
def plot_prediction(X_test, Y_test, Y_pred, epoch, n_epochs):
fig=plt.figure()
plt.clf()
ax = plt.subplot(1,1,1)
ax.set_ylim([-1,1])
plt.title("Epoch #"+str(epoch)+"/"+str(n_epochs))
plt.plot(X_test[:,0],Y_test,label="True")
print(Y_pred)
plt.plot(X_test[:,0],Y_pred,label="Predicted")
plt.legend()
plt.savefig('test.png')
plt.close(fig)
return