TExcelTAD
Home › Lab Skills: Measurement, Uncertainty & Graphs › Plotting a Graph and the Best-Fit Line

Plotting a Graph and the Best-Fit Line

A question to start

The spring table from the last lesson has seven rows of numbers. Does the extension grow steadily with the load, or does it speed up? Is any reading odd? Staring at the numbers, it's hard to say. On a graph (đồ thị) you see the answer at a glance.

The idea: a good graph, step by step

  1. Axes. The independent variable goes across (xx-axis), the dependent variable up (yy-axis).
  2. Labels. Each axis gets the quantity and unit, written like a table heading: "load FF / N", "extension xx / cm".
  3. Scales. Choose an easy step per large square, 1, 2 or 5 (times a power of ten), never 3 or 7. The points should fill more than half of the grid in both directions. The scale must be even: equal distances for equal steps. The axes don't have to start at zero unless you need the intercept.
  4. Points. Plot each point carefully as a small cross (×\times) or a dot in a small circle, so you can still see exactly where it is.
  5. Best-fit line. If the points look like a straight line, draw one straight line with a ruler that passes as close as possible to all of them, with points scattered evenly above and below it. If the trend is curved, draw one smooth curve. Never join the dots.
  6. Anomalies. A point far from the line is not forced into it: circle it, check it, and leave it out of the line if it is a mistake.
BAD 0 2 5 10 15 0 2 4 6 load stretch uneven scale, no units, dot to dot, big blobs, a small part of the page 0 1 2 3 4 5 6 0 2 4 6 8 10 12 14 16 load F / N extension x / cm GOOD even scales, labels with units,small crosses, one best-fit line

Why a best-fit line?

Every point has a random error, so the points scatter a little around the true relationship. The best-fit line averages the scatter, just as the mean averages repeated readings. Joining the dots would copy every random error into the graph and hide the real pattern.

Drawing it by eye. Place a transparent ruler so that about as many points lie above it as below, and their distances balance. A useful trick: calculate the mean point (xˉ,yˉ)(\bar{x}, \bar{y}) and make the line pass through it. The least-squares line that calculators and spreadsheets work out always goes through the mean point, and it makes the sum of the squared vertical distances from the points, Σr2\Sigma r^2, as small as possible.

Worked example: the spring graph

Given: the spring data (load F=0.0F = 0.0 to 6.0 N6.0\ \text{N}, extension x=0.0x = 0.0 to 15.1 cm15.1\ \text{cm}). Find: sensible scales, and what the best-fit line shows. Solve:

  • xx-axis: 00 to 6 N6\ \text{N}, 1 N1\ \text{N} per large square (6 squares).
  • yy-axis: 00 to 16 cm16\ \text{cm}, 2 cm2\ \text{cm} per large square (8 squares). A step of 3 cm3\ \text{cm} would make plotting 7.57.5 awkward, so 22 is better.
  • The mean point is Fˉ=3.0 N\bar{F} = 3.0\ \text{N}, xˉ=0+2.6+5.1+7.5+10.2+12.6+15.17=53.17=7.59 cm\bar{x} = \frac{0 + 2.6 + 5.1 + 7.5 + 10.2 + 12.6 + 15.1}{7} = \frac{53.1}{7} = 7.59\ \text{cm}.
  • The points lie close to a straight line through the origin and through (3.0,7.59)(3.0, 7.59).

Answer: extension is directly proportional to load: a straight line through the origin, as Hooke's law says. Check: no point is far from the line, so there is no anomaly.

Reading values off the graph. For a load of 3.5 N3.5\ \text{N}, go up from 3.53.5 on the xx-axis to the line and across: about 8.8 cm8.8\ \text{cm}. Reading between measured points (interpolation) is reliable. Reading beyond them (extrapolation, for example at 12 N12\ \text{N}) is risky: the spring could stop obeying the straight line, or be damaged.

Try it in the simulation

Here is a similar spring experiment with six points and their error bars. The dotted line is your line: it always passes through the mean point, and the slider Gradient of your line turns it. Make Σr2\Sigma r^2 ("your Σr2\Sigma r^2") as small as you can, then press Play to see the least-squares line and compare. Use the Data set slider for new data.

0123456705101520F (N)extension (cm)your lineleast-squares fitsteepest / shallowestyour gradient: 2.00 cm/Nyour Σr² = 2.93taking readings: 6 of 6error bars ±0.60 cm

With data set 1 the least-squares gradient is 2.385 cm/N2.385\ \text{cm/N} and its Σr2\Sigma r^2 is 0.335 cm20.335\ \text{cm}^2; no other straight line does better.

Try it: your own graph

Use your helicopter, pendulum or bouncing-ball data, or the pendulum table from the last lesson. Plot it on graph paper (or in a spreadsheet, then check the scales and labels yourself). Ask a friend to check your graph against the six steps above.

Common mistakes

  • Joining the dots, or drawing a wobbly freehand "line".
  • An uneven scale, such as 0,2,5,10,150, 2, 5, 10, 15 at equal spacing.
  • Awkward scale steps (3 or 7 per square), which make plotting slow and error-prone.
  • A tiny graph in one corner of the paper.
  • Forcing the line through the origin, or through the first and last points, when the data don't go there.
  • Big blobs for points, which hide where the point really is.

Practice

  1. Readings of yy go from 00 to 4646; the graph paper has 10 large squares up. Which scale per large square is best: 44, 55 or 1010?
Answer

55 per square: 10×5=5010 \times 5 = 50 covers 4646 and uses most of the grid. 44 is an awkward step, and 1010 would squeeze the points into the bottom half.

  1. Four points lie on a smooth curve and one point is far above it. A student draws a line that bends up to reach that point. What should he have done?
Answer

Draw the smooth curve through the other points, circle the odd point as an anomaly, check or repeat that measurement, and say in the report why it was left out.

  1. Find the mean point of (1,3.1)(1, 3.1), (2,4.9)(2, 4.9), (3,7.2)(3, 7.2), (4,8.8)(4, 8.8).
Answer

xˉ=104=2.5\bar{x} = \frac{10}{4} = 2.5, yˉ=24.04=6.0\bar{y} = \frac{24.0}{4} = 6.0: the mean point is (2.5,6.0)(2.5, 6.0), and a best-fit line should pass through it.

Test yourself

How should a best-fit line be drawn through points that lie roughly in a straight line?

  1. Join each point to the next
  2. One straight line with points evenly scattered on both sides
  3. Through the first and last points only
  4. Always through the origin

Which scale step per large square is a good choice?

  1. 3 units
  2. 7 units
  3. 2 units
  4. it doesn't matter

Reading a value from the graph between two measured points is called ...

  1. extrapolation
  2. interpolation
  3. linearising
  4. calibration

Which point does the least-squares line always pass through?

  1. The origin
  2. The first point
  3. The mean point (xˉ,yˉ)(\bar{x}, \bar{y})
  4. The highest point