Okay this might be easy even I search on web but could not get it. Basically i want to add the two different labels to my plot and this is my line of code for that
plt.plot(x[:,1],y,'ro',x[:,1],Line_fit,'b',linewidth=0.5,markersize=4,label="training data") # plot the data
plt.legend(loc="upper left")
but I am getting following result in which has same labels for both the plot.as following
Even I tried this
plt.plot(x[:,1],y,'ro',x[:,1],Line_fit,'b',linewidth=0.5,markersize=4,label="training data",label="Linear Regression") # plot the data
but give the error:
SyntaxError: keyword argument repeated
This link guide for the simple way but here plt.plot()
had used twice in the accepted answer.My question is how can i do it the same thing in single line code as I did in my code ?