6.7.16
Grasp frequency at a glance with a barcode timeline
When only the event dates matter, a barcode timeline is a compact way to show density with vertical lines. It makes period bias and bursts visible at a glance.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| import pandas as pd
import matplotlib.pyplot as plt
dates = pd.to_datetime(
[
"2024-01-05",
"2024-01-08",
"2024-01-12",
"2024-01-20",
"2024-02-02",
"2024-02-07",
"2024-02-08",
"2024-02-17",
"2024-03-01",
"2024-03-09",
"2024-03-10",
"2024-03-24",
"2024-04-02",
"2024-04-18",
"2024-05-01",
]
)
fig, ax = plt.subplots(figsize=(6.4, 1.8))
ax.vlines(dates, ymin=0, ymax=1, color="#0f172a", linewidth=2)
ax.set_ylim(0, 1)
ax.set_yticks([])
ax.set_title("Barcode timeline of critical alert dates")
ax.set_xlabel("Date")
ax.set_xlim(dates.min() - pd.Timedelta(days=3), dates.max() + pd.Timedelta(days=3))
ax.tick_params(axis="x", rotation=45)
ax.spines[["left", "top", "right"]].set_visible(False)
fig.tight_layout()
plt.show()
|

Reading tips
#
- Denser lines indicate periods of concentrated events. It helps communicate recent congestion or peaks quickly.
- Varying line height or color lets you encode event types or weights at the same time.
- For long timelines, split by month or enable scrolling to keep it readable.
- Gantt Chart — List task start-end periods with horizontal bars
- Rug Plot — Display individual data points as short lines along the axis
- Calendar Heatmap — Overview daily metrics across a year by weekday × week