I am writing a code to find the least squares of best fit line of some data in an imported file. The equation of the line is ax+b
where I have calculated a
and b
already. To plot the line I have tried:
LS_fit_ydata = []
for i in x_data:
y_new = ((i*b) + a)
LS_fit_ydata.append(y_new)
I am using matplotlib.pyplot as plt
to plot my graph.
There are no error messages but the line does not appear on my graph. Does anyone know what's going wrong? Thank you for any help you can provide.