matplotlib scatter label points code example
Example 1: add text to plot python scatter
y = [2.56422, 3.77284, 3.52623, 3.51468, 3.02199]
z = [0.15, 0.3, 0.45, 0.6, 0.75]
n = [58, 651, 393, 203, 123]
fig, ax = plt.subplots()
ax.scatter(z, y)
for i, txt in enumerate(n):
ax.annotate(txt, (z[i], y[i]))
Example 2: how to get label for points from a column in dataframe for scatter plot in python
groups = data.groupby("Category")