The line of best fit and scatterplots in Google Sheets

Being 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 in Excel was a piece of cake. I could never do it in Google Sheets until I found a solution! It is easy to build a meaningful scatterplot, put in a trendline and find the correlation coefficient within a couple of clicks.

Using #google #sheets it is easy to insert a line of best fit in a scatterplot Click To Tweet


Before we delve into how to draw a scatterplot in Sheets, please indulge me as I explain what a scatterplot is and how we find the strength of the relationship between data. If we put a pot of water on some heat and measured the temperature at certain times, we would get two pieces of data that are related to each other. If we add heat longer to the pot of water, 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.

By following these easy steps students can hypothesise, record data, chart and analyse their results using #google #sheets. Click To Tweet


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.

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


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: