Skip to content
Tactiverge

School/○ Innovator/Week 8

Choose the plot that answers the question

Same sensor log, three questions: is it drifting? How noisy is it? Is it related to temperature? Why should those be three different charts?

About 35 min · 3 goals · Checked by automated tests

1.Why should I care?

A chart is an answer to a question. Pick the wrong kind and the answer is hidden, however good the data. Engineers choose the plot after writing the question down, and label it so a reader can check it without asking them.

  • ◇ Match a plot type (line, scatter, histogram, bar) to the question being asked.
  • ◇ Label a plot fully: quantity, unit, title and data source.
  • ◇ Write matplotlib code that produces a labelled line plot.

2.Watch

→ Watch how the axis labels, title and legend are added: those lines are what turn a picture into evidence.

Makes and labels a first line plot in Python, including titles, axis labels and legends.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

The video is optional: everything you need is also in the lesson text and the interactive.

3.Predict

You want to see how a motor's temperature changed during a 30-minute test. Which plot?

Guess first. Being wrong here is how the surprise works.

4.Discover

Switch between bars and a line. Which form makes the change over the year easiest to read? Which makes the before/after comparison easiest? Then turn on the error bars: what extra question can you now answer?

Loading the interactive…

Can't use the interactive? Read a description instead

The chart critique shows monthly conveyor jams as bars or as a line. A line shows the change across the year most clearly; bars from zero make the before and after levels easy to compare; error bars show the day-to-day spread so the size of the change can be judged against it.

5.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

Does a servo's current draw rise with the load on its arm? You have 40 (load, current) pairs. Which plot?

6.Understand

Question first, plot second

Change over time → line (time on x). Relationship between two measurements → scatter. Spread of one measurement → histogram (or box plot). Comparing a few groups → bars (from zero) or points with error bars. Parts of a whole → a stacked bar is usually clearer than a pie.

Label like a datasheet

Every axis gets a quantity and a unit: 'Motor temperature (°C)', 'Time (s)'. Add a title that states the finding or the question, a legend if there is more than one series, and a note of where the data came from and how many samples.

Show the data, not just a summary

Plot the individual readings when you can, and add the mean on top. A single average bar hides spread, outliers and drift, which are often exactly what an engineer needs to see.

Explain it another way

A map answers 'where?', a clock answers 'when?'. Charts are the same: each kind answers a different kind of question well.

Worked example 1

A fully labelled line plot of a motor temperature log.

import matplotlib
matplotlib.use("Agg")                    # draw to a file, no window needed
import matplotlib.pyplot as plt

time_s = [0, 60, 120, 180, 240, 300, 360]
temp_c = [21.0, 26.5, 31.2, 34.8, 37.1, 38.4, 39.0]

fig, ax = plt.subplots(figsize=(6, 3.5))
ax.plot(time_s, temp_c, marker="o")
ax.set_xlabel("Time since start (s)")
ax.set_ylabel("Motor case temperature (°C)")
ax.set_title("Temperature levels off near 39 °C (7 readings, 1 per minute)")
ax.set_ylim(0, 45)
ax.grid(True, alpha=0.3)
fig.tight_layout()
fig.savefig("motor_temp.png", dpi=150)

Common mix-ups

  • Any chart will do if the data is right.
    ✓ The wrong chart can hide the answer. Choose the type from the question.
  • Titles should just name the variables.
    ✓ A good title states what the reader should notice, or the question the chart answers.

7.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2

How noisy is a gyro at rest? You have 5,000 readings. Which plot shows the spread best?

Practice 3

Which y-axis label is best?

Practice 4 · a fresh version every time

A log of motor temperature (°C) reads xs = [63, 66, 59, 62, 60, 54, 60]. What is the median, statistics.median(xs)? Give 2 decimal places.

8.Apply it

Take a sensor log you have (or the motor test CSV from week 3). Write three questions about it and make one correctly chosen, fully labelled plot for each. Under each, write one sentence answering its question.

9.Reflect

Concepts: Honest data visualisation · Describing data