L5 Making Charts in Google Sheets

DATA SCIENCE · CYCLE 1 · L5 · TEXTBOOK CHAPTER

Making Charts in Google Sheets

In L3 you chose a chart type from the job it had to do. Now the spreadsheet does the drawing. Sheets charts the cells you select, and six checks tell you when a stranger can read the chart.

After this chapter, you can

Why It Matters

A spreadsheet uses the cells you select, and only those cells. Select the wrong block and the answer is wrong. Nothing warns you.

In January 2010 two Harvard professors, Carmen Reinhart and Ken Rogoff, presented a study of 20 countries. Its best-known number was an average. In years when a government’s debt was more than 90% of the size of the country’s economy, the economy shrank by 0.1% a year, on average. Politicians in Europe and the United States quoted the 90% limit.

Thomas Herndon was a graduate student at the University of Massachusetts Amherst. His class assignment was to repeat the numbers of a published study. He chose this one, and he could not get the same answer. He asked the professors for their spreadsheet, and they sent it.

He found a mistake in one formula. It averaged the cells in rows 30 to 44. The countries ran down to row 49. Five countries were left out: Australia, Austria, Belgium, Canada and Denmark. The average used 15 of the 20 countries.

Nothing in the spreadsheet turned red. That range alone moved the average by 0.3 points. Herndon and two of his professors corrected other choices in the study too, and published the work on 15 April 2013. With all the corrections, the average was growth of 2.2% a year. The study had said −0.1%. The two Harvard professors thanked them for the correction.

A chart is built the same way: from the block of cells you select. Sheets charts what is in that block and nothing else. So this chapter starts with the block. You select it from the header row down to the last row of data, and you check it.

The Idea

The cells you select, then six checks

Sheets charts the data range you select, headers too. Six checks finish a chart.

  1. The title names THE THING: what was measured.
  2. The title names THE WHO: who or what the data is about.
  3. The title names THE WHEN: the dates the data covers.
  4. Both axes have a title.
  5. Every axis that shows numbers has its unit in brackets: Life expectancy (years).
  6. A stranger could read it with no help from you.

The six checks are the Chart Label Checklist. A chart is finished when a person who was not in the room can read it. On a project chart, the six checks decide the Data Visualization and Representation row of the Data Cycle Rubric.

A Chart Is Built From a Data Range

The class file has two tabs, long and wide. The long tab has 60 rows of data: five countries, twelve years each. Its columns are country, year, life expectancy, GDP per capita and population.

A chart in Google Sheets is built from a data range: the block of cells you select before you choose Insert > Chart. Sheets reads the top row of the data range as the names of the columns, and every row under it as data. So the rule is: select the header row too.

Rows 1 to 8 of the long tab, with five columns: country, year, life expectancy, GDP per capita and population. The year and life expectancy columns are shaded from the header cells down.
The long tab. To chart life expectancy over time, you select the shaded block: year and life expectancy, from the header cells down to the last row. Source: Our World in Data, 2000 to 2011.

Row 1 of the long tab is the header row. It names the columns, and it holds no data. Select B2:C13 without B1:C1 and Sheets has no names to use. Your horizontal axis reads 1, 2, 3 where it should read 2000, 2001, 2002. Nothing is broken. You left the names out.

In Sheets: Get the Class File

The class file is called L5 charts. Its link is in the L5 module in Canvas.

  1. Open the link in today’s Canvas module. Click Make a copy.
  2. Click the file name at the top left and rename it: L5 charts, your name.
  3. Work only in your copy.

Pairs at one laptop work in one copy. The owner clicks Share and adds the partner’s APS email as Editor, so both can download the charts.

In Sheets: Make the Chart

  1. Show only the rows you want (Filter, below).
  2. Select the data range, header row included.
    • Columns side by side: click the first header, then drag across and down to the last row you want.
    • Columns apart, such as Date and a later column: select the Date column from row 1 to your last row, hold Command, then select your measure’s column over the same rows.
  3. Insert > Chart.
  4. In the chart editor, on Setup, set Chart type yourself.
  5. Still on Setup, check three things. X-axis names the column that should run across (year, Date, or your categories). Series lists only what you measured. Use row 1 as headers is ticked. If the horizontal axis reads 1, 2, 3, or a line you did not measure appears, fix it here.
  6. Customize > Chart & axis titles. Use the dropdown to move between Chart title, Chart subtitle, Horizontal axis title and Vertical axis title, and type each one (the title rule, below).
  7. Editor closed? Double-click the chart.
  8. Download a graded chart as soon as it passes the six checks, before you sort or filter again: click the chart, the three dots at its top right, Download > PNG image.

Sheets guesses a chart type from the shape of the data range. You still set the type yourself, every time. The type comes from the reader’s question, and Sheets has never met your reader.

Two checks pick a chart. The variable type rules some charts out: no line through categories, no mean of a nominal variable. The job picks among what is left. These are the chart types on the Setup list:

Column chart and Bar chart are both the poster’s Bar Graph. Sheets has no dot plot and no box plot on its list.

The Title, the Axis Titles and the Units

The title says what the whole chart is about. An axis title says what one direction measures and, if it shows numbers, in what unit.

The title rule

Axis titles and units

A chart with the title “Life Expectancy” and no axis titles scores 1 of 6. It names the thing. It has no who, no years, no axis titles and no unit.

Long and Wide

The same numbers can be laid out two ways. In long data every row is one country in one year, so a country’s name repeats once per year: 5 countries times 12 years is 60 rows. In wide data every row is one year and every country gets its own column: 12 rows, 6 columns.

countryyearlife expectancy
Japan200081.2
Japan200181.5
Brazil200069.6

Long, the first tab: three of its 60 rows.

yearJapanBrazil
200081.269.6
200181.570.0

Wide, the second tab: two of its 12 rows, and two of its five countries.

Sheets draws one line per column. A Line chart from the long tab gives one zigzag line in which each year appears five times. From the wide tab it gives five lines, one per country. Long data is what you filter and sort. Wide data is what a chart of several lines needs.

Line chart titled Life expectancy in five countries, 2000 to 2011. Five lines, each named at its right end. From top to bottom: Japan, United States, Brazil, India, Nigeria. The vertical axis title is Life expectancy (years).
Chart 3, built from the whole wide tab in one selection. Five columns became five lines. Japan runs from 81.2 to 82.7 years, and Nigeria from 47.1 to 51.5. Source: Our World in Data.

One series needs no legend. Several series keep the legend, or name each line at its right end, as Chart 3 does.

One Axis, One Unit

Put Brazil’s GDP per capita and life expectancy on one vertical axis, and the axis has to reach 14,831 to fit the dollars. Life expectancy changes by 4.4 years on an axis 16,000 tall. Its line lies flat along the bottom of the chart, and you cannot read one value off it. Example 2 proves it with arithmetic.

The rule: if two numbers are measured in different units, they do not belong on the same axis. The fix is two charts, one per unit.

Sheets can add a second axis on the right. This course does not use one in Cycle 1. A second axis lets the chart maker stretch either line to tell any story they like.

Sorting and Filtering

To sort is to reorder the rows. Every row moves as one piece. To filter is to hide rows. Nothing moves and nothing is deleted. Sorting and filtering are Data Processing. VDOE calls sort, select, filter and replace wrangling.

Filter

  1. Data > Create a filter.
  2. Click the filter icon in the header of the column you want.
  3. Clear, tick the values to keep, OK.

Filtered rows are hidden and never deleted, and a chart leaves them out. A filter set to Brazil leaves 12 rows visible and 48 hidden. To turn the filter off: Data > Remove filter.

Sort

  1. Select the whole block from A1, header row included.
  2. Data > Sort range > Advanced range sorting options.
  3. Tick Data has header row.
  4. Pick the column, then A to Z (smallest first) or Z to A (largest first).
  5. For a tie-breaker, Add another sort column.
  6. Sort.

Always sort the whole block. A sort of one column alone moves that column and leaves the rest, so every row goes wrong and nothing turns red. To undo: Command-Z (Edit > Undo) until the rows come back.

Here is that mistake on the long tab. Sort life expectancy Z to A (largest first), two ways, and read row 2.

Row 2 aftercountryyearlife expectancy
a whole-block sortJapan200983.0
a sort of column C aloneUnited States200083.0

The second row is false. Column C moved, and the other four columns stayed. The 83.0 is Japan’s number for 2009, and it now sits beside United States and 2000. No country ever had those three values together.

Worked Examples

Example 1 · Build and title Chart 1. A reader asks: how did life expectancy in Brazil change from 2000 to 2011? Build the chart on the long tab. Title it to pass all six checks.

Create a strategy

One country measured every year is a trend over time. The job is Data Over Time, and the chart is a Line chart. Then follow the steps: filter to one country, select the data range with its headers, insert the chart, set the type yourself, check Setup, and type three titles.

Apply the idea
  1. Data > Create a filter.
  2. Click the filter icon in the country header.
  3. Clear, tick Brazil, OK. Twelve rows stay visible: rows 26 to 37.
  4. Click the year header cell. Drag across to the life expectancy header cell and down to row 37.
  5. Insert > Chart.
  6. In the chart editor, on Setup, set Chart type to Line chart.
  7. Still on Setup, check three things. X-axis says year. Series lists only life expectancy. Use row 1 as headers is ticked.
  8. Customize > Chart & axis titles. Use the dropdown to move between the three titles in the table, and type each one.
  9. Click the chart, the three dots at its top right, Download > PNG image.

The data range is B1:C37. Rows 2 to 25 are hidden, and the chart leaves them out. So it charts 2 columns and 13 rows, header row included.

In the dropdownType
Chart titleLife expectancy in Brazil, 2000 to 2011
Horizontal axis titleYear
Vertical axis titleLife expectancy (years)
Line chart titled Life expectancy in Brazil, 2000 to 2011. One line rises every year, from 69.6 to 74.0. The horizontal axis title is Year. The vertical axis title is Life expectancy (years).
Chart 1, a chart that scores 6 of 6. The title names THE THING (life expectancy), THE WHO (Brazil) and THE WHEN (2000 to 2011). The vertical axis has its unit. Source: Our World in Data.
Reflect and check

Read the title as a stranger. What is measured: life expectancy. Who: Brazil. When: 2000 to 2011. Both axes have a title, and the vertical one is in years. Six of six.

Check the line too. It should rise from 69.6 to 74.0 with no zigzag. A zigzag means the rows were out of year order. The fix is a whole-block sort by country, then by year.

Try It: Title the Chart

A classmate made this Line chart from the long tab, filtered to Nigeria. It shows life expectancy, in years, for 2000 to 2011. The chart passes 1 of the 6 checks. Type new titles until it passes all six.

Example 2 · Two units on one axis. Chart 2 puts Brazil’s life expectancy and GDP per capita on one vertical axis. The axis runs 0 to 16,000 on a chart 400 pixels tall. What does the life expectancy line look like?

Line chart of Brazil, 2000 to 2011, with two lines on one vertical axis that runs 0 to 16,000. The GDP per capita line climbs from about 10,000 to about 15,000. The life expectancy line lies flat along the bottom. The vertical axis title asks: what unit?
Chart 2, the bad one, built on purpose from year, life expectancy and GDP per capita for Brazil. The vertical axis has no honest title, because it carries two units. Source: Our World in Data.
Create a strategy

Find how many units of the axis fit in one pixel. Then find how many pixels tall each line’s whole change is.

Apply the idea

Units per pixel: 16,000 ÷ 400 = 40.

LineChange, 2000 to 2011Pixels tall: change ÷ 40
GDP per capita14,831 − 9,834 = 4,997about 125
life expectancy74.0 − 69.6 = 4.40.11

Life expectancy gets 0.11 of one pixel. A screen cannot draw part of a pixel. The line lies flat along the bottom of the chart, and its twelve values cannot be told apart.

Reflect and check

Would a taller chart help? Make it ten times taller, 4,000 pixels. Now 16,000 ÷ 4,000 = 4 units fit in one pixel, and life expectancy gets 4.4 ÷ 4 = 1.1 pixels. Still flat.

The problem is the units. Life expectancy is in years. GDP per capita is in international dollars per person per year. The fix is two charts, one per unit.

Two line charts side by side. Left: Life expectancy in Brazil, 2000 to 2011, rising from 69.6 to 74.0 years. Right: GDP per capita in Brazil, 2000 to 2011, rising from about 9,800 to about 14,800 international dollars per person per year.
The fix: one chart per unit. Each vertical axis now has a title that is true, and each line uses the full height of its own chart. Source: Our World in Data, 2000 to 2011.

Example 3 · Read a Scatter chart. Chart 4 is a Scatter chart of Brazil. What does the red dot stand for, and what puts it where it is?

Scatter chart titled Life expectancy and GDP per capita in Brazil, 2000 to 2011. Twelve dots rise from lower left to upper right. A red dot is marked 2005: 71.8 years across, 11,306 dollars up. The horizontal axis title is Life expectancy (years). The vertical axis title is GDP per capita (international dollars per person per year).
Chart 4, a Scatter chart: 12 rows, 12 dots. The red dot is the row for Brazil in 2005. Source: Our World in Data.
Create a strategy

A Scatter chart is built from two number columns. Each row of the data range becomes one dot. The left column places the dot across, and the right column places it up.

Apply the idea

The data range was life expectancy and GDP per capita, filtered to Brazil, header row included. Twelve rows became 12 dots.

The red dot sits at 71.8 across and 11,306 up. In the long tab that is one row, row 31: Brazil, 2005, life expectancy 71.8 years, GDP per capita 11,306 international dollars per person per year. Its life expectancy places it left to right. Its GDP per capita places it up and down.

Reflect and check

Whichever column sat further left in your selection becomes the horizontal axis. Check the axes before you type their titles. Both axes show numbers, so both carry a unit.

Read the whole chart: as life expectancy rises, GDP per capita rises. It holds for all 12 dots, because both numbers rose in Brazil in every year from 2000 to 2011. Every dot is the same country in a different year. So the pattern is something that happened over time in one place. It says nothing about any other country, and it is no proof that money causes long life.

In your project

Your Cycle 1 project is your own data, collected over about a month. It is kept in one Google Sheet with RAW, CLEAN, a cleaning log and ABOUT tabs. Its charts and a one-page Google Doc tell the story. Every chart is made with this chapter’s steps, and the six checks decide the Data Visualization and Representation row of the Data Cycle Rubric.

THE SHAPE of your question points to a job, and the job picks the chart.

THE SHAPEJob (function)In Sheets
A trend over timeData Over TimeLine chart. A Column chart of the days comes second.
A comparison between groupsComparisonsColumn chart, or Bar chart when the names are long or the bars are sorted by size
Two numbers togetherRelationshipsScatter chart
A single numberData Over Time, for nowA Line chart of your days in order. Then add the comparison that gives the number meaning, such as school nights against weekend nights.

A number each day. Select the Date column from row 1 to your last row, hold Command, then select your measure’s column over the same rows. Insert > Chart, then Line chart.

A label or a 1 to 5 rating. On a new tab, type a small table: one row per label (ratings in order, 1 to 5) and the number of days it happened. Chart that table as a Column chart. Vertical axis title: Days (count). No line through ratings.

The source. A project chart names its source in the subtitle: Customize > Chart & axis titles > Chart subtitle, then type Source: my own log, 9 September to 9 October 2026.

Check Yourself

Answer each one before you look. The first two are from L3 and L4, so you keep them.

A claim: “The line at the school store got longer every week in October.” Which job does the chart have to do? L3

Each day you rate your lunch from 1 to 5. What type of variable is the rating? L4

Your log has a header row and 30 rows of data. Date is in column A and Reading (min) is in column B. Which data range do you select for a chart?

A chart has the title “Travel time on the Route 52 bus, 5 to 23 October 2026”. Its horizontal axis title is “Date”. Its vertical axis title is “Travel time”. How many of the six checks does it pass?

A student measured rainfall in Arlington each day from 1 March to 31 May 2026. Which chart title names THE THING, THE WHO and THE WHEN?

A long table holds 6 clubs, each counted in 9 weeks, one row per club per week. How many rows of data does it have?

A chart puts steps per day and resting heart rate on one vertical axis. The axis runs 0 to 18,000 on a chart 300 pixels tall. Heart rate varies from 58 to 73 beats per minute. How many pixels tall is that change?

A log has Date in column A and Sleep (hours) in column B. Maya selects only column B and sorts it. What is true now?

A Scatter chart shows one town in 15 different years. Each dot is one year: rainfall across, umbrellas sold up. The dots rise from left to right. What does the chart show?

Read More

Google Docs Editors Help: Add & edit a chart or graph. Google’s own steps for charts in Sheets. It calls the data range “the set of cells you want to include”. Read three parts: Make a chart or graph, Change the chart type, and Edit titles.

Stuck on any of this? Ask Mr. Case in class or send him a message in Canvas. Name the example or the question number, and say which step lost you.