Time Series • Time Series Analysis and Components
Time Series / P2.01 Graphical Display of a Series

P2.01 Graphical Display of a Series

Practical 2 Time Series Analysis and Components

Produce two graphical displays of the same 16-week demand series: a time plot and a histogram. Explain what each graph is good for.

Practical / Solution

P2.01 Graphical Display of a Series

Problem Statement

Produce two graphical displays of the same 16-week demand series: a time plot and a histogram. Explain what each graph is good for.

Learning Outcomes

  • Use a time plot for order and pattern.
  • Use a histogram for the distribution of values.

Hint

Do not replace the time plot with a histogram. They answer different questions.

Theory

Graphical displays include time plots, histograms and scatter plots of lagged values. The time plot keeps chronology; the histogram summarises level and spread.

Dataset / Data Source

Constructed 16 weekly demand values. Teaching data.

Analysis / Program

import pandas as pd import matplotlib.pyplot as plt weeks = pd.date_range("2026-01-05", periods=16, freq="W-MON") demand = [30, 32, 31, 35, 36, 34, 38, 40, 39, 41, 44, 42, 45, 47, 46, 48] ts = pd.Series(demand, index=weeks) fig, axes = plt.subplots(1, 2, figsize=(9, 4)) ts.plot(ax=axes[0], marker="o", title="Time plot") ts.hist(ax=axes[1], bins=6) axes[1].set_title("Histogram") plt.tight_layout() plt.show()

Expected Output

A pair of charts: a rising time plot and a histogram of the 16 values.

Result / Interpretation

The time plot shows the upward movement. The histogram shows that later high values pull the distribution to the right. Both views are useful.

Note

A histogram ignores time order. Always keep a time plot when the data are a series.