I've show the y1 label using plt.annotate, but I couldn't do the same for the y2. Could you help me?
plt.figure(figsize=(10,4))
x = [201901, 202001, 202101, 202202]
y1 = [6.86, 21.45, 6.25, 0.88]
y2 = [6.33, 6.33, 7.04, 5.63]
plt.box(False)
plt.plot(x, y1, marker='o', label='Your Return')
plt.plot(x, y2, marker='o', label='Benckmark')
plt.legend()
plt.title('Your Return vs Benckmark', pad=30)
plt.xlabel('Period')
plt.ylabel('Return')
for x, y in zip(x, y1):
label = y
plt.annotate(label, (x, y),
xycoords="data",
textcoords="offset points",
xytext=(0, 10), ha="center")
plt.show()

You just had to add another for loop for
y1to annotate the data. I've also renamedxtox_as the name of the iterator otherwise it overrides your original variable.Output: