1import matplotlib.pyplot as plt
2w = 4
3h = 3
4d = 70
5plt.figure(figsize=(w, h), dpi=d)
6x = [1, 2, 4]
7x_pos = 0.5
8y_pos = 3
9plt.text(x_pos, y_pos, "text on plot")
10plt.plot(x)
11plt.savefig("out.png")Outputout.png
1y = [2.56422, 3.77284, 3.52623, 3.51468, 3.02199]
2z = [0.15, 0.3, 0.45, 0.6, 0.75]
3n = [58, 651, 393, 203, 123]
4
5fig, ax = plt.subplots()
6ax.scatter(z, y)
7
8for i, txt in enumerate(n):
9 ax.annotate(txt, (z[i], y[i]))