Draw the First Measurement Plot
Put ordered measurements on visible coordinates, then label the quantity, units, and observations that give those positions meaning.
A plot is useful when it answers a numerical question. We will begin with a small one: how did the first sensor's calibrated reading change across three ordered observations?
Pair Observation Order with One Sensor
The chapter uses the same measurement computation as the preceding numerical work:
The calibrated table is:
[[ 2. 6.]
[ 3. 8.]
[ 4. 10.]]
Axis 0 means observations and axis 1 means sensors. The first sensor is the
first column, so its values are [2.0, 3.0, 4.0]. Pairing them with
observation = [0, 1, 2] gives three plotted points:
(0, 2.0), (1, 3.0), (2, 4.0)
Check the two one-dimensional shapes before drawing:
observation shape: (3,)
reading shape: (3,)
(0, 2.0)
(1, 3.0)
(2, 4.0)
Each horizontal value now has exactly one vertical value. The printed pairs are the numerical evidence behind the marks that will appear in the plot.
Q1. Identify the plotted pairs
Which points should appear when observation order [0, 1, 2] is paired with
the first sensor values [2.0, 3.0, 4.0]?
Select one choice, then check.
HintMatch equal positions
The first array supplies horizontal coordinates. The value at the same position in the second array supplies the vertical coordinate.
SolutionForm three ordered pairs
The points are (0, 2.0), (1, 3.0), and (2, 4.0). Reversing each pair
would exchange the meanings of the axes.
Draw through an Explicit Axes Object
Matplotlib separates the complete figure from the plotting area inside it:
fig, ax = plt.subplots()
fig owns the complete figure. ax is the axes object on which we draw and
set labels. Keeping both names makes later saving and comparison code clear.
The following runnable example draws the three pairs:
Plot the first sensor across observation order
Three circular markers show the recorded calibrated readings. The connecting line shows their order, and printed pairs preserve the exact numerical evidence.
Ready to run.
The marker identifies each recorded point. The line helps the eye follow the
known order from observation 0 to 2. It does not claim that measurements
were recorded between those positions.
The labels state the quantities rather than merely x and y. The vertical
label includes the fact that the values are calibrated and gives a unit place;
replace the generic word units with the actual unit when the dataset supplies
one. The title identifies both the sensor and the comparison.
Q2. Complete a labelled measurement plot
Complete the plotting code so it uses an explicit figure and axes, draws circular markers, and labels both quantities.
Editable Python
Ready to run.
HintUse the axes object for every plot setting
Begin with fig, ax = plt.subplots(). Call ax.plot with both arrays and
marker="o", then use ax.set_xlabel, ax.set_ylabel, and ax.set_title.
SolutionDraw and label the three points
The numerical output checks the number of plotted pairs and both endpoints.
State Only What the Plot Shows
The three calibrated readings increase from 2.0 to 3.0 to 4.0. That is a
direct observation supported by both the plot and the printed values. With only
three points, we should not claim that every future reading will increase, that
the change is caused by observation order, or that values between the recorded
positions followed the drawn segments.
The line plot preserves order. It does not preserve the second sensor column, because we selected only the first sensor for this question. It also does not show the raw readings separately. A useful interpretation says what the chosen view preserves and what evidence remains outside it.
Q3. Interpret the visible evidence cautiously
Which statement is supported by this three-point line plot?
Select one choice, then check.
HintStay with the observed positions
The plot contains three measurements. It contains no future values and no measurements between observation indexes.
SolutionDescribe the recorded increase
The supported statement is that the three recorded values increase in order
from 2.0 to 4.0. The plot does not establish future behavior or values
between the observations.
A line plot pairs explicit horizontal and vertical values, uses markers to identify recorded points, and uses a line to preserve their order. Keep the numerical pairs beside the figure, label quantities and units, and limit the interpretation to visible evidence. The next lesson asks a different question: comparing magnitudes across named sensor categories.