matplotlib point labels

Solutions on MaxInterview for matplotlib point labels by the best coders in the world

showing results for - "matplotlib point labels"
Chris
06 Jun 2019
1import matplotlib.pyplot as plt
2import numpy as np
3
4plt.clf()
5
6# using some dummy data for this example
7xs = np.arange(0,10,1)
8ys = np.random.normal(loc=2.0, scale=0.8, size=10)
9
10plt.plot(xs,ys)
11
12# text is left-aligned
13plt.text(2,4,'This text starts at point (2,4)')
14
15# text is right-aligned
16plt.text(8,3,'This text ends at point (8,3)',horizontalalignment='right')
17
18plt.show()