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
38
39
40
41
42
43
| import matplotlib.pyplot as plt
import numpy as np
brands = ["Layanan A", "Layanan B", "Layanan C", "Layanan D", "Layanan E"]
score_2023 = np.array([62, 55, 48, 44, 38])
score_2024 = np.array([75, 58, 64, 40, 42])
colors = plt.cm.Blues(np.linspace(0.4, 0.8, len(brands)))
fig, ax = plt.subplots(figsize=(6, 4))
for idx, name in enumerate(brands):
ax.plot(
[0, 1],
[score_2023[idx], score_2024[idx]],
color=colors[idx],
linewidth=2.5,
)
ax.scatter([0, 1], [score_2023[idx], score_2024[idx]], color=colors[idx], s=60)
ax.text(
-0.05,
score_2023[idx],
f"{name} {score_2023[idx]:.0f}",
ha="right",
va="center",
)
ax.text(
1.05,
score_2024[idx],
f"{score_2024[idx]:.0f}",
ha="left",
va="center",
)
ax.set_xticks([0, 1], labels=["2023", "2024"])
ax.set_title("Perubahan NPS layanan utama (poin)")
ax.set_ylim(30, 80)
ax.spines[["top", "right", "bottom"]].set_visible(False)
ax.tick_params(left=False, bottom=False)
ax.set_yticks([])
ax.grid(axis="y", alpha=0.15)
fig.tight_layout()
plt.show()
|