fig,ax=plt.subplots(figsize=(8,5)) ax.plot(range(1,13),error_train,label="Train") ax.plot(range(1,13),error_cv,label="Cross Validation",color="green") ax.legend() plt.xlabel("Number of training examples") plt.ylabel('error') plt.title('Learning curve of linear regression') plt.show()