y = 2 * x
z = x ** 2
fig, ax = plt.subplots()
ax.plot(x, y, 'bo-')
for X, Y, Z in zip(x, y, z):
    ax.annotate('{}'.format(Z), xy=(X, Y), xytext=(-5, 5), ha='right',
        textcoords='offset points')
plt.show()
Matplotlib - labelling points (x,y) on a line with a value z