Including full source code.
In this article we see how to fit a straight line to the data in a scatter plot.