Choosing a graph, and the line of best fit
What this lesson covers
- A distribution is formed from all the possible values of a variable and their frequencies. It can be shown using data visualisations that show patterns, trends, and variations and that include dot plots, bar graphs, frequency tables, box plots, histograms, time-series graphs, scatter plots, and two-way tables.
- A good data visualisation should allow viewers to discern the variable(s) and who the data was collected from, and then, depending on the type of visualisation, additional information such as frequency, proportions, patterns or trends, and units for numerical variables.
- In relationship investigations: sometimes one variable is thought of as predictive of the other variable; then the response or dependent variable is on the y-axis, and the ‘predictive’, explanatory, or independent variable is on the x-axis an eyeballed line or curve of best fit can be added for paired numerical data.
A graph is not decoration
- It is the picture of a distribution.
- So which graph you draw is decided by the data.
- Not by which one you find easiest to draw.
What a distribution actually is
- All the values your variable took.
- Together with how often each one happened.
- That pairing is the distribution. A graph shows it.
| Part | Detail | Note |
|---|---|---|
| All the values | that the variable took | |
| With their frequencies | how often each one happened | |
| Together | that is the distribution | |
| A graph | is a picture of it | not a decoration |
The kind of variable picks the graph
- One categorical variable: a bar graph.
- One numerical: a dot plot, a histogram, or a box plot.
- Two numerical and paired: a scatter plot.
| What you have | What to draw | Example |
|---|---|---|
| One categorical | bar graph | sport, year level |
| One numerical | dot plot, histogram, box plot | height, score |
| Two numerical, paired | scatter plot | hours against score |
| Numerical over time | time-series graph | rainfall by month |
| Two categorical | two-way table | sport by year level |
Why the wrong graph loses information
- Draw heights as a bar graph and each height becomes a category.
- You have thrown away the order, and the spacing.
- 150 is nearer 152 than 180, and a bar graph cannot say so.
| Choice | What happens | Note |
|---|---|---|
| Bar graph of heights | treats each height as a category | |
| What is lost | the order and the gaps | |
| Numbers have spacing | 150 is closer to 152 than to 180 | |
| A dot plot keeps it | so use that |
What a reader must be able to work out
- What was measured, and who it was measured on.
- The units, for anything numerical.
- A graph that needs you there to explain it has failed.
| Must show | Meaning | Where |
|---|---|---|
| The variable | what was measured | axis label |
| The group | who it was measured on | title |
| The units | for anything numerical | cm, minutes, dollars |
| The frequencies | or the pattern | depends on the graph |
And usually you draw more than one
- A dot plot shows every individual value.
- A box plot shows the quartiles from last lesson.
- Different graphs of the same data answer different questions.
Choosing a scale
- Data from 60 to 82 on an axis running to 1000 is a stripe.
- Run the axis from 60 to 85 and you can read it.
- Cover your data, with a little room. That is the whole rule.
| Data | Axis | Result |
|---|---|---|
| Data runs 60 to 82 | an axis of 0 to 1000 | everything in a stripe |
| Same data | an axis of 60 to 85, steps of 5 | readable |
| Rule of thumb | cover the data, with a little room |
Try it: let the data choose
Now the scale trick worth knowing about
- Two values: 100 and 105. A rise of five percent.
- Start the axis at zero and the bars look nearly identical.
- Start it at 95 and the second bar is twice the height.
| Version | What it looks like | Verdict |
|---|---|---|
| Two values: 100 and 105 | a rise of 5% | |
| Axis from 0 | the bars look almost the same | honest |
| Axis from 95 | the second bar is twice the first | misleading |
| Nothing was faked | the numbers are identical |
Try it: the scale trick
And nothing was faked
- Both graphs plot exactly the same two numbers.
- The data is honest and the picture is not.
- Which is why you check the axis before believing a graph.
Two paired variables: a scatter plot
- Hours studied and test score, for eight students.
- Each student is one dot: their hours across, their score up.
- And the cloud clearly slopes upward.

Which variable goes on which axis
- The explanatory variable goes across the bottom.
- The response variable goes up the side.
- Ask: which of the two could plausibly affect the other?
| Axis | Variable | Here |
|---|---|---|
| x-axis | the explanatory variable | hours studied |
| y-axis | the response variable | test score |
| The test | which could affect the other? | |
| Study affects score | not the other way round |
That test works because the arrow only points one way
- Studying longer could change your score.
- Your score cannot reach back and change how long you studied.
- So hours is explanatory, and it goes on x.
| Hours | Score | Hours | Score |
|---|---|---|---|
| 1 hour | 60 | 5 hours | 72 |
| 2 hours | 64 | 6 hours | 76 |
| 3 hours | 66 | 7 hours | 78 |
| 4 hours | 70 | 8 hours | 82 |
The line of best fit is drawn by eye
- That is not a shortcut. It is the method at this level.
- Through the middle, with about as many points above as below.
- It will miss most of the points, and that is correct.
| Rule | ||
|---|---|---|
| Through the middle of the cloud | ||
| Roughly as many above as below | ||
| It will miss most of the points | that is correct | |
| Do not join the dots | that is a different, wrong thing |
Try it: drag the points
And then you use it to predict
- What score might five and a half hours give?
- Up from 5.5 to the line, then across. About 74.
- Check it is sensible: between the 72 and the 76. It is.
| Step | Working | Note |
|---|---|---|
| Question | what score for 5.5 hours? | |
| Go up from 5.5 | to the line, then across | |
| Read off | about 74 | |
| Sensible? | between 72 and 76 | yes |
What to take away
- Six things, and the fourth one you will see in the news.
| A distribution | is the values and how often each occurred |
| The graph | is chosen by the kind of variable, not by taste |
| Every graph needs | the variable, the group, and the units |
| A y-axis not starting at zero | exaggerates the difference |
| The explanatory variable | goes on x, the response on y |
| A line of best fit | is drawn by eye and misses most points |
Common mistakes
- Heights drawn as a bar graph with one bar per height.Height is numerical, so use a dot plot, histogram or box plot, which keep the order and spacing of values.
- Score on the x-axis and hours studied on the y-axis.The explanatory variable (hours) goes on the x-axis and the response (score) on the y-axis.
- The line of best fit must go through the first and last points.An eyeballed line follows the trend with about as many points above it as below; it need not touch any point.
- Starting the y-axis at 95 just shows more detail.A y-axis that does not start at 0 can make a 5% change look like a doubling; start at 0 or mark the break clearly.
Your turn
- Try all eight.
Favourite sport per student. Which graph?
Sleep and reaction time. Graph? Which axis?
Bars of 100 and 105, axis from 95. Wrong?
Should a line of best fit pass through every point?
A survey records each student's favourite sport and year level. Which display shows both together?
Heights in a class run from 148 cm to 176 cm. Which axis suits a dot plot of them?
A dot plot is titled "Our results" and its axis is labelled only "Time". What is missing?
A line of best fit for hours studied (x) against score (y) passes through (2, 30) and (6, 50). Predict the score for 4 hours.
Show answer
1. A bar graph. Favourite sport is one categorical variable. 2. A scatter plot, because they are two paired numerical variables. Hours slept goes on x, since sleep could affect reaction time, and reaction time goes on y. 3. The difference is only 5 percent, but starting at 95 makes the second bar look twice as tall. The numbers are honest and the picture is not. 4. No. It should pass through the middle of them, with roughly as many above as below, and it will miss nearly all of them. Joining the dots is a different thing and it is not a line of best fit. 5. A two-way table. Both variables are categorical, so a two-way table counts each pair. 6. 145 cm to 180 cm, in steps of 5. It covers every value from 148 to 176 with a little room; the other axes leave some heights off. 7. Who was measured, and the units of time. A reader cannot tell the group or whether it is seconds, minutes or hours. 8. 40. The line rises 20 over 4 hours, which is 5 per hour, so from (2, 30) two more hours gives 30 + 10 = 40.
The answers
- Favourite sport is one categorical variable.
- Sleep could affect reaction time, not the reverse.
- A line of best fit misses most points.
| Answer | |
|---|---|
| 1 | A bar graph |
| 2 | Scatter, sleep on x |
| 3 | The axis exaggerates |
| 4 | No |
Least-Squares Regression

Full screen · PhET Interactive Simulations, University of Colorado Boulder, CC BY 4.0
Challenge
Sixteen students at a Napier school recorded their trip to school, in whole minutes: 4, 5, 6, 6, 7, 7, 8, 9, 12, 15, 16, 17, 17, 18, 19, 20. (a) Ana draws a histogram with intervals 0 to 9, 10 to 19 and 20 to 29 minutes. Find the three bar heights. (b) Ben draws one with intervals 0 to 4, 5 to 9, 10 to 14, 15 to 19 and 20 to 24. Find the five bar heights. (c) Find the mean trip time, and count how many students are within 2 minutes of it. (d) Which histogram gives the truer picture, and what feature of the data does the other one hide?
Hint
Same data, two pictures. Sketch both and look at where the values bunch up. Then ask how typical the mean really is.
Answer
(a) 8, 7, 1. (b) 1, 7, 1, 6, 1. (c) Mean 11.625 minutes, and only 1 student (12 minutes) is within 2 minutes of it. (d) Ben's. It shows two clusters, around 5 to 9 and around 15 to 19 minutes (perhaps walkers and bus riders), with a gap between them. Ana's wide bars merge the groups and make 10 to 19 minutes look typical, when almost nobody takes 10 to 14.
Step by step
- Count the values in each interval for both histograms.
- Ana's bars fall steadily, so the data looks like one group with most trips under 20 minutes.
- Ben's bars have two tall peaks with a dip in between, so there are two separate groups.
- The mean sits right in the gap: only one student is close to it.
- A graph is chosen to show the distribution, and bars that are too wide can hide its shape. A dot plot of all 16 values would show the two clusters too.
Full working
- 0 to 9: 4, 5, 6, 6, 7, 7, 8, 9 → 8Ana's first bar
- 10 to 19: 12, 15, 16, 17, 17, 18, 19 → 7; 20 to 29: 20 → 1Ana's other bars
- Ben: 0 to 4 → 1; 5 to 9 → 7; 10 to 14 → 1; 15 to 19 → 6; 20 to 24 → 1narrower intervals
- Total = 186, mean = 186 ÷ 16 = 11.625add, then divide
- Within 2 minutes means 9.625 to 13.625: only 12 → 1 studentthe mean is in the gap
- Ben's histogram: two clusters with a gap, hidden by Ana's wide bars
A histogram shows the heights of 20 Year 9 students, measured to the nearest whole centimetre. The bars are 145 to 149 cm: 2 students, 150 to 154 cm: 5, 155 to 159 cm: 8, 160 to 164 cm: 4, 165 to 169 cm: 1. The raw data has been lost. (a) What are the smallest and largest possible values of the range? (b) What are the smallest and largest possible values of the mean? Could the mean be 159 cm? (c) Between which two heights must the median lie? (d) Tama says, "The tallest student is 169 cm." Is that a fair conclusion from the graph?
Hint
Each student could be anywhere inside their bar. To push a value to its extreme, put every student at the bottom of their bar, or every student at the top.
Answer
(a) Range at least 16 cm and at most 24 cm. (b) Mean at least 154.25 cm and at most 158.25 cm, so it cannot be 159 cm. (c) The median is between 155 and 159 cm. (d) No: the tallest student could be any height from 165 to 169 cm.
Step by step
- A histogram keeps how many values fall in each interval but throws away the exact values.
- The range is smallest when the shortest student is as tall as possible (149) and the tallest as short as possible (165).
- The range is largest with the shortest at 145 and the tallest at 169.
- Putting every student at the bottom of their bar gives the lowest possible mean, and at the top the highest. Each top is 4 cm above its bottom, so the means differ by 4.
- The 10th and 11th heights decide the median, and counting up the bars puts both in 155 to 159.
- The graph only says the tallest is somewhere from 165 to 169, so Tama is claiming more than the picture shows.
Full working
- Smallest range = 165 − 149 = 16shortest high in bar 1, tallest low in bar 5
- Largest range = 169 − 145 = 24opposite ends
- Lowest total = 2×145 + 5×150 + 8×155 + 4×160 + 1×165 = 3085everyone at the bottom of their bar
- Lowest mean = 3085 ÷ 20 = 154.25total over count
- Highest total = 3085 + 20 × 4 = 3165, mean = 3165 ÷ 20 = 158.25everyone 4 cm higher
- 159 > 158.25, so a mean of 159 cm is impossibleoutside the possible values
- Running totals 2, 7, 15: the 10th and 11th are in 155 to 159median of 20 values
- Range 16 to 24 cm, mean 154.25 to 158.25 cm, median 155 to 159 cm; Tama is wrong
Eight netballers in a Rotorua team recorded practice hours per week (h) and goals scored out of 20 shots (g): (1, 6), (2, 9), (3, 9), (4, 12), (5, 13), (6, 13), (7, 17), (8, 18). The coach wants a line of best fit of the form g = 1.5h + c, with exactly 4 points above it, 4 below it and none on it. (a) Which variable goes on which axis? (b) For which values of c does the coach's line work? (c) Her assistant tries lines of the form g = 2h + c instead. Show that no value of c gives 4 above, 4 below and none on the line. (d) Using a line from (b), predict the goals for a player who practises 4.5 hours a week.
Hint
For each point work out g − 1.5h. The point is above the line exactly when this number is bigger than c. Then think about where c must sit in the sorted list.
Answer
(a) Practice hours on the x-axis (explanatory), goals on the y-axis (response). (b) Any c between 5.5 and 6, not including 5.5 or 6. (c) The values of g − 2h are 4, 5, 3, 4, 3, 1, 3, 2, and three of them are 3, which is exactly where c would have to sit. (d) Between 12.25 and 12.75 goals, so about 12 or 13 goals out of 20.
Step by step
- Practice could affect goals, not the other way round, so hours go across and goals go up.
- A point is above g = 1.5h + c when g − 1.5h is bigger than c, and below when it is smaller.
- Sorted, the values of g − 1.5h are 4, 4.5, 4.5, 5.5, 6, 6, 6, 6.5. To split them 4 and 4, c must be above 5.5 and below 6.
- For slope 2 the sorted values are 1, 2, 3, 3, 3, 4, 4, 5. The 4th and 5th are both 3, so a split of 4 and 4 needs c above 3 and below 3 at once.
- With c just under 3 there are 6 above; with c just over 3 only 3; with c = 3 three points sit on the line.
- Using any working line, the prediction at 4.5 hours is 6.75 + c, which lies between 12.25 and 12.75.
Full working
- g − 1.5h: 6 − 1.5 = 4.5, 9 − 3 = 6, 9 − 4.5 = 4.5, 12 − 6 = 6first four players
- 13 − 7.5 = 5.5, 13 − 9 = 4, 17 − 10.5 = 6.5, 18 − 12 = 6last four players
- Sorted: 4, 4.5, 4.5, 5.5, 6, 6, 6, 6.5c must fall between the 4th and 5th
- So 5.5 < c < 6strictly, so no point is on the line
- g − 2h: 4, 5, 3, 4, 3, 1, 3, 2 → sorted 1, 2, 3, 3, 3, 4, 4, 5the 4th and 5th are both 3
- c just under 3 gives 6 above, c over 3 gives at most 3 above, c = 3 puts 3 points on the linenever 4 and 4
- g = 1.5 × 4.5 + c = 6.75 + c, between 12.25 and 12.75interpolation, inside the data
- About 12 or 13 goals; c must satisfy 5.5 < c < 6
Where science uses this
Report a mistake
More in Statistics
Is your child on track?
Take the free placement test

