Compare Paired Measurements

Keep matching values from each observation together, then describe the visible relationship without adding a cause the plot cannot establish.

A scatter plot compares two values that belong to the same observation. Its central requirement is not sorting or connecting points. It is preserving each pair.

Build Pairs from Matching Positions

Use the recurring raw table and calibration:

For the North sensor, compare each raw reading with its calibrated value:

raw: [2. 4. 6.]
calibrated: [2. 3. 4.]
(2.0, 2.0)
(4.0, 3.0)
(6.0, 4.0)

Each pair comes from one row in the original table:

ObservationRaw NorthCalibrated NorthScatter point
02.02.0(2.0, 2.0)
14.03.0(4.0, 3.0)
26.04.0(6.0, 4.0)

The observation index is not drawn as an axis, but it still determines which two values belong together. Both arrays have shape (3,), which is necessary but not sufficient: their positions must also refer to the same observations in the same order.

Q1. Trace one paired point

Observation 1 has raw North reading 4.0 and calibrated North reading 3.0. Which point represents it when raw is horizontal and calibrated is vertical?

Choose one

Select one choice, then check.

HintUse the axis order

A scatter coordinate is (horizontal, vertical). Here that means (raw, calibrated).

SolutionThe point is (4.0, 3.0)

The horizontal raw coordinate is 4.0, and the vertical calibrated coordinate from the same observation is 3.0.

Not attempted
Review

Not marked done.

Draw the Paired Values

ax.scatter(horizontal, vertical) places one mark for each pair of positions:

Compare raw and calibrated readings for one sensor

Three scatter points preserve observation identity between raw and calibrated North-sensor readings. A dashed equality line marks where a reading would be unchanged.

Command/Ctrl + Enter. Python runs in your browser.

Ready to run.

The scatter marks are not connected because horizontal order is not the relationship this view is meant to preserve. The point positions compare raw and calibrated values. Observation identity remains in the paired array positions and the printed table.

The dashed line shows y=xy=x. In this plot that line has a stated meaning: a point on it has an unchanged calibrated value. The first point (2, 2) lies on the line. The points (4, 3) and (6, 4) lie below it because their calibrated values are smaller than their raw values.

A reference line should not be added merely to fill the plot. It belongs here because equality answers a real comparison question. If equal horizontal and vertical values had no useful interpretation, the line would be decoration and should be omitted.

Q2. Create a paired scatter plot

Complete the scatter plot with raw readings on the horizontal axis and the matching calibrated readings on the vertical axis. Add the equality reference and label both quantities.

Editable Python

Command/Ctrl + Enter. Python runs in your browser.

Ready to run.

HintKeep both arrays in their original order

Call ax.scatter(raw_north, calibrated_north). Plot equality_limits against itself with linestyle="--", then add the labels and title.

SolutionPlot corresponding positions together

The three printed pairs are the exact coordinates behind the scatter marks.

Not attempted
Review

Not marked done.

Do Not Break the Pairing

Sorting one array independently changes which values are paired. Consider a different calibrated order:

These positions preserve the observation pairs (6, 4), (2, 2), and (4, 3). Sorting only the raw array creates:

(2.0, 4.0)
(4.0, 2.0)
(6.0, 3.0)

All shapes still match, and Matplotlib can draw the result. The points are wrong because values from different observations have been joined. If an order change is required, compute one ordering of observation positions and apply it to both arrays.

The three correct points also lie exactly on the known calibration rule y=0.5x+1y=0.5x+1. That agreement is expected because calibrated was computed from raw with that formula. It is a check of the program, not evidence that three independent observations revealed a new scientific law.

Q3. Diagnose a broken pairing

A program independently sorts the raw values but leaves the calibrated values in their original order before calling scatter. What should we conclude?

Choose one

Select one choice, then check.

HintTrack the observation behind each value

Equal shapes guarantee the number of coordinates. They do not guarantee that corresponding positions still name the same record.

SolutionApply one ordering to both arrays

Sorting only one side breaks observation identity, although the plotting call still runs. Preserve the original order or use one index order to rearrange both raw and calibrated arrays together.

Not attempted
Review

Not marked done.

A scatter plot places one paired value on each axis. Preserve record identity, print or tabulate the exact pairs, and add a reference line only when it has a named interpretation. Describe the visible relationship cautiously: a plot can check a known computation without proving a new cause or general rule. The next lesson asks what remains when observation order is deliberately set aside to inspect a distribution.

Pause and reflect

In your own words, note what you understood, what remains unclear, or what you want to revisit. The note stays with this lesson.

0 of 3 exercises marked done

Review

Not marked done.