I'm trying to make a view in Django which will take a list of numbers for the x and y axis and return an image much like the one produced from the code below. I need the linear regressor in the image as well.
Note: it doesn't have to be through using pylab, the output is what matters most.
from pylab import *
x = [1,54,4,5,67,3,12]
y = [3,23,67,1,3,43,7]
(m, b) = polyfit(x,y,1)
print(b)
print(m)
yp = polyval([m,b],x)
plot(x, yp)
scatter(x, y)
grid(True)
xlabel('x')
ylabel('y')
show()
I found code similar to this here.
As always, thanks for the help!