Geek Culture
Published in

Geek Culture

Fitting a line to a scatter plot in Matplotlib

Photo by Mike U on Unsplash

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

As a simple example of a scatter plot, for a group of people we might record their height and their shoe size. A scatter plot would then consist of one dot for each person, indicating their height (x) and shoe size (y).

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Martin McBride

Martin McBride

Software developer. Java, Python, C++ etc. I write for pythoninformer.com and maintain the generativepy library.