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
| import matplotlib.pyplot as plt
teams = ["วางแผน", "พัฒนา", "QA", "CS"]
timeline = [
[(1, 3), (5, 2)],
[(2, 5), (8, 3)],
[(4, 3), (8, 2)],
[(3, 2), (7, 4)],
]
colors = ["#38bdf8", "#818cf8", "#f472b6", "#facc15"]
fig, ax = plt.subplots(figsize=(6.2, 3.8))
for idx, (team, segments) in enumerate(zip(teams, timeline)):
for seg, color in zip(segments, colors):
ax.broken_barh([seg], (idx - 0.35, 0.7), facecolors=color, alpha=0.85)
ax.set_ylim(-1, len(teams))
ax.set_xlim(0, 12)
ax.set_yticks(range(len(teams)), labels=teams)
ax.set_xticks(range(0, 13))
ax.set_xlabel("สัปดาห์")
ax.set_title("แผนภูมิแกนต์สำหรับเตรียมรีลีสรายไตรมาส")
ax.grid(axis="x", alpha=0.2, linestyle="--", linewidth=0.8)
ax.set_axisbelow(True)
milestones = {"สเปกล็อก": 3, "ทดสอบเสร็จ": 9}
for label, week in milestones.items():
ax.axvline(week, color="#475569", linestyle=":", linewidth=1.2)
ax.text(week + 0.1, len(teams) - 0.4, label, rotation=90, va="top", fontsize=9)
fig.tight_layout()
plt.show()
|