Sub topic 9
Plotting Points from a Table of Values
A table of values lists input values and their matching output values. On a coordinate plane, each row becomes an ordered pair \((x, y)\). You should already know how to read ordered pairs, use positive and negative numbers, and choose a scale on a number line.
Turn Each Row into an Ordered Pair
The first column usually gives the \(x\)-coordinate. The second column gives the \(y\)-coordinate. Keep the values in the same row together.
| \(x\) | \(y\) | Ordered pair |
|---|---|---|
| -2 | -3 | \((-2,-3)\) |
| -1 | -1 | \((-1,-1)\) |
| 0 | 1 | \((0,1)\) |
| 1 | 3 | \((1,3)\) |
| 2 | 5 | \((2,5)\) |
For example, the row with \(x=-1\) and \(y=-1\) gives the point \((-1,-1)\). Move one unit left from the origin, then one unit down.
The order matters. The pair \((2,5)\) means two units right and five units up. It does not mean five units right and two units up.
Plot the Points
Before plotting, choose axis scales that include every value in the table. If the largest \(x\)-value is 2 and the smallest is -2, an axis from -3 to 3 may be enough. Use equal intervals unless the problem clearly requires a different scale.
Plot each pair by following the same process:
- Start at the origin.
- Move horizontally according to \(x\).
- Move vertically according to \(y\).
- Mark and label the point.
For the table above, the points are:
- \((-2,-3)\), in quadrant III
- \((-1,-1)\), in quadrant III
- \((0,1)\), on the y-axis
- \((1,3)\), in quadrant I
- \((2,5)\), in quadrant I
A coordinate with value zero places a point on an axis. The point \((0,1)\) is one unit above the origin on the y-axis.
Describe the Pattern
After plotting, inspect how the points are arranged. In the example, every increase of 1 in \(x\) causes \(y\) to increase by 2. The points lie on a straight line. The pattern matches the rule
\[ y=2x+1. \]
You can verify the rule with any row. When \(x=2\),
\[ y=2(2)+1=5. \]
The point \((2,5)\) is therefore on the graph.
Not every table produces a straight line. If the changes in \(y\) are not constant as \(x\) changes by equal amounts, the points may form a curve or another pattern. Plot first, then describe what the points show. Do not connect points automatically when the table represents separate measurements rather than a continuous relationship.
Plotting with Python
The following program plots the example points and connects them in their table order:
import matplotlib.pyplot as plt
x_values = [-2, -1, 0, 1, 2]
y_values = [-3, -1, 1, 3, 5]
plt.scatter(x_values, y_values, color="blue")
plt.plot(x_values, y_values, color="blue", alpha=0.5)
for x, y in zip(x_values, y_values):
plt.annotate(f"({x}, {y})", (x, y), xytext=(5, 5),
textcoords="offset points")
plt.axhline(0, color="black", linewidth=0.8)
plt.axvline(0, color="black", linewidth=0.8)
plt.xlim(-3, 3)
plt.ylim(-4, 6)
plt.xticks(range(-3, 4))
plt.yticks(range(-4, 7))
plt.grid(True)
plt.xlabel("x")
plt.ylabel("y")
plt.show()The zip operation takes one \(x\)-value and one \(y\)-value from matching positions, preserving each table row.
Exercise
A table has the pairs \((-3,4)\), \((0,1)\), and \((3,-2)\). What pattern do these points suggest, and what is the change in y for an increase of 3 in x?
Show answer
The points suggest a straight-line pattern. When x increases by 3, y decreases by 3, so the change in y is -3.