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
- Select a data range with its headers and set the chart type.
- Score a chart on the six checks and rewrite its titles.
- Filter and sort whole rows; keep one unit on each axis.
- Tell long data from wide data, and say which one Sheets needs for one line per country.
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.
- The title names THE THING: what was measured.
- The title names THE WHO: who or what the data is about.
- The title names THE WHEN: the dates the data covers.
- Both axes have a title.
- Every axis that shows numbers has its unit in brackets: Life expectancy (years).
- 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.
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.
- Open the link in today’s Canvas module. Click Make a copy.
- Click the file name at the top left and rename it: L5 charts, your name.
- 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
- Show only the rows you want (Filter, below).
- 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.
- Insert > Chart.
- In the chart editor, on Setup, set Chart type yourself.
- 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.
- 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).
- Editor closed? Double-click the chart.
- 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:
- Line chart: a line through values in order.
- Column chart: bars standing up.
- Bar chart: bars lying on their side.
- Scatter chart: one dot per row, from two number columns.
- Pie chart.
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
- Every chart title names THE THING, THE WHO and THE WHEN: Life expectancy in Brazil, 2000 to 2011.
- A chart you present to other people (from L7 on, and every project chart) also says what the numbers did, in a sentence that keeps the thing, the who and the when: Life expectancy in Brazil rose every year, 2000 to 2011.
Axis titles and units
- Both axes get a title, written Measure (unit): Life expectancy (years), Sleep (hours), Days (count).
- An axis of categories or dates takes its name only: Country, Year, Date. Year and Date need no unit.
- Find the axis that shows the numbers and put the unit there. In a Column chart the numbers run up. In a Bar chart they run across. In a Scatter chart both axes show numbers, so both carry a unit.
- Units stay out of the title.
- An axis title that repeats the chart title gets shortened to the measure and its unit. Axis titles and units are never deleted.
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.
| country | year | life expectancy |
| Japan | 2000 | 81.2 |
| Japan | 2001 | 81.5 |
| Brazil | 2000 | 69.6 |
Long, the first tab: three of its 60 rows.
| year | Japan | Brazil |
| 2000 | 81.2 | 69.6 |
| 2001 | 81.5 | 70.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.
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
- Data > Create a filter.
- Click the filter icon in the header of the column you want.
- 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
- Select the whole block from A1, header row included.
- Data > Sort range > Advanced range sorting options.
- Tick Data has header row.
- Pick the column, then A to Z (smallest first) or Z to A (largest first).
- For a tie-breaker, Add another sort column.
- 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 after | country | year | life expectancy |
| a whole-block sort | Japan | 2009 | 83.0 |
| a sort of column C alone | United States | 2000 | 83.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 strategyOne 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
- Data > Create a filter.
- Click the filter icon in the country header.
- Clear, tick Brazil, OK. Twelve rows stay visible: rows 26 to 37.
- Click the year header cell. Drag across to the life expectancy header cell and down to row 37.
- Insert > Chart.
- In the chart editor, on Setup, set Chart type to Line chart.
- Still on Setup, check three things. X-axis says year. Series lists only life expectancy. Use row 1 as headers is ticked.
- Customize > Chart & axis titles. Use the dropdown to move between the three titles in the table, and type each one.
- 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 dropdown | Type |
| Chart title | Life expectancy in Brazil, 2000 to 2011 |
| Horizontal axis title | Year |
| Vertical axis title | 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 checkRead 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?
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 strategyFind 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.
| Line | Change, 2000 to 2011 | Pixels tall: change ÷ 40 |
| GDP per capita | 14,831 − 9,834 = 4,997 | about 125 |
| life expectancy | 74.0 − 69.6 = 4.4 | 0.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 checkWould 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.
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?
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 strategyA 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 checkWhichever 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 SHAPE | Job (function) | In Sheets |
| A trend over time | Data Over Time | Line chart. A Column chart of the days comes second. |
| A comparison between groups | Comparisons | Column chart, or Bar chart when the names are long or the bars are sorted by size |
| Two numbers together | Relationships | Scatter chart |
| A single number | Data Over Time, for now | A 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
The claim is about a sequence: the weeks of October, in order. That job is Data Over Time, and the chart is a Line chart with time across. Proportions needs one whole split into parts, and weeks in order have no whole to be part of. Comparisons puts separate groups side by side. Here one thing, the line at the store, is measured again each week.
Each day you rate your lunch from 1 to 5. What type of variable is the rating? L4
A rating is a label with an order. A 4 is above a 3, but nobody can say the gap from 3 to 4 equals the gap from 1 to 2. It is written in digits and it counts nothing, so discrete is wrong. Nominal labels have no order. On a chart, a rating gets a Column chart of the days at each level, levels in order, and no line.
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?
The header row is row 1, so 30 rows of data end in row 31. A1:B31 takes the header row and every row of data. A2:B31 leaves the header row out, so Sheets has no names to use. A1:B30 leaves out the last row of data. A range that stops short is the mistake in the debt study at the top of this chapter.
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?
- THE THING: yes, travel time.
- THE WHO: yes, the Route 52 bus.
- THE WHEN: yes, 5 to 23 October 2026.
- Both axes have a title: yes.
- The unit in brackets: no. The vertical axis shows numbers and has no unit. Travel time (min) passes.
- A stranger: no. A stranger has to ask whether the numbers are minutes or hours.
It passes 4 of 6.
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?
It names the thing (rainfall), the who (Arlington) and the when (1 March to 31 May 2026). The first title has no who, and it puts the unit in the title. Units stay out of the title: the unit goes on the axis, as Rainfall (inches). The third title has no dates.
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?
6 clubs × 9 weeks = 54 rows. The same numbers as wide data take 9 rows, one per week, and 7 columns: week, and one column per club. Sheets draws one line per column, so the wide table gives six lines.
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?
- Units per pixel: 18,000 ÷ 300 = 60.
- Heart rate changes by 73 − 58 = 15.
- In pixels: 15 ÷ 60 = 0.25.
That is a quarter of one pixel, so the heart rate line is flat. Steps and beats per minute are different units. The fix is two charts, one per unit.
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?
Only column B moved. Column A stayed, so a date now sits beside the hours from a different night. Nothing turns red. Command-Z (Edit > Undo) until the rows come back. Then sort the whole block from A1, header row included, with Data has header row ticked.
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?
Every dot is the same town in a different year, so the pattern is something that happened in one place. It says nothing about any other town. Dots that rise together show two numbers moving together. They do not show that one made the other happen, in either direction.
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.