How to Create Line of Best Fit & Scatterplots in Google Sheets

31 January 2019
Adrian Francis

As a maths teacher, I always liked collecting data and finding the strength of the relationship between the data. Making a scatterplot and finding the line of best fit or trendline was a piece of cake in Excel, but I could never do it in Google Sheets until I found a way to build a meaningful scatterplot, put in a trendline and find the correlation coefficient within a couple of clicks.

If scatterplots are a foreign concept or how to find the strength of the relationship between data, read on.

Here’s a helpful metaphor to illustrate how a scatterplot works. If we put a pot of water on some heat and measure the temperature at certain times, we would get two pieces of data that are related to each other. If we heat the pot for a longer period, the hotter the water will become. This is called a direct correlation.

If we collected the data and put it in a table we would have two variables and be able to draw a scatterplot of time versus temperature. The stronger the relationship between the two variables the stronger the correlation is. A perfect correlation is 1 and this can be represented by r2.

When we put data like this into a table and draw a scatterplot in Sheets, we would get a scatterplot that looks like this.

This is not correct as it is treating the data on the x-axis as text and not numbers. Follow these steps to change this:

  • Create a scatterplot by highlighting the data and clicking on Insert > Chart
  • Change the chart style from column to scatter chart
  • Click on Customise
  • Go to Horizontal axis
  • Un-check the box that says Treat labels as text

Click on Series
Check the Trendline box and the Show R2 box.

This now displays a scatterplot of your data, shows you the formula of the trendline or line of best fit and shows you the strength of the correlation.

This allows students to gather real data, tabulate it and then present and analyse it in a meaningful way. This ticks the boxes for me as a teacher as the students are able to hypothesise about the relationship between two variables and then test it easily using Google Sheets and a scatterplot.

Check out our other blogs on combining text and numbers in cells, using macros in macros in Google Sheets and tips and tricks in Google Sheets.

Recent Posts

Here’s What
Our Clients Say

PR Industrya


In 2018, Using Technology Better designed and delivered a two phase post-migration training program for this New Zealand based graphic design firm. The initial goal of the training program was to reduce frustration with G Suite, with the long term aim of facilitating a change in culture and collaboration that can lead to transformative practices

Download your skills checklist to see how you score...


Choose Industry:

Which Skills Checklist?


Nice Move Allstar!
You're about to get
awesome value in your
inbox that's going to make
life that little bit easier & sweeter!


Pop in your details below and we'll send you the PLD Checklist 📧

First time applying for MoE Funded PLD?

Get the Latest Blog Posts, New Tips And Tricks


NSW DoE Leadership Webinars


NSW DoE Leadership Webinars


Holiday Rescue Maker Camp

Student to agree to and tick:
Guardian to agree to and tick: