Matplotlib · Study

English translation

Topics covered

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

Changes over Time and Comparisons across Categories

Line plots suit reading sequences and continuous changes; bar charts suit reading magnitudes by category. Even for the same data, an unsuitable plot can suggest unintended relationships.

Fair Visual Comparisons

Match axis ranges and units when comparing conditions. Also check sample counts and missing values, and verify a relationship shown by the graph with a calculation.

Worked example

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

import numpy as np
import matplotlib.pyplot as plt
t=np.arange(5);temp=np.array([20,21,23,22,24])
plt.plot(t,temp,'o-');plt.xlabel('Time [s]');plt.ylabel('Temperature [C]');plt.grid()
실행 결과

Reference example

View more examples

Reference materials