Matplotlib

English translation

The same numbers reveal different relationships depending on the graph. Distinguish changes over time from comparisons across categories.

Before practice

01 Can a time series be plotted as a bar chart?

Description

Yes, but choose according to the relationship you want to convey: continuous change or category sizes.

02 Does changing the axis range change the perceived trend?

Description

The same data can appear to change greatly or slightly, so fix the axes of comparison plots.

Practice

Preview practice notebookDownload practice notebook

1. Choosing a Plot for the Representation

Starting conditions

t=[01234]t=\begin{bmatrix}0&1&2&3&4\end{bmatrix}, temperature=[20,21,23,22,24] °C.

Procedure

  1. Display the same data as a line plot and a bar chart.
  2. Use actual values to explain which representation makes trends or values at specific times easier to read.

Results to retain

Items to record and points to check
Representation
Observed facts
Times and values used
Suitable purpose

Points to check

  • Did you display axis titles, units, and ticks?

2. Comparing Two Measurements

Starting conditions

Add the second sensor's data [19,21,22,23,23] and compare on the same axes.

Procedure

  1. Associate the second sensor values [19,21,22,23,23] with the same times 0,1,2,3,40,1,2,3,4, and plot them on the same axes in the same Figure as the first sensor.
  2. Use a legend to distinguish the two sensors. Record time, first sensor value, second sensor value, and first minus second in five rows.
  3. Find and explain the times when the two sensors agree and differ most, using the table and plots.

Results to retain

Items to record and points to check
Time
First sensor value
Second sensor value
First minus second value

Points to check

  • Did you compare the two sensors' values at matching times?

3. Checking Other Inputs

Starting conditions

Plot the same two sensors' data as a scatter plot, and compare interpretations when time order is removed.

Procedure

  1. Pair the two sensors' values at each time and create a scatter plot with the first sensor on the x-axis and the second on the y-axis. Use the same data as the preceding time plot.
  2. Label each point with its time to identify the sample. Explain the relationship between the two sensors visible in the scatter plot separately from the sequence of changes that cannot be inferred without time labels.

Results to retain

Items to record and points to check
The two scatter plot axes
Correspondence between Times and Points
Visible relationship between the two sensors
Interpreting Changes over Time

Points to check

  • Can you map scatter plot points back to their original times?