scatter axis label matplotlib code example
Example 1: how to label points in scatter plot in python
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.scatter(z, y)
for i, txt in enumerate(n):
ax.annotate(txt, (z[i], y[i]))
Example 2: matplotlib scatter
# Import packages
import matplotlib.pyplot as plt
%matplotlib inline
# Create the plot
fig, ax = plt.subplots()
# Plot with scatter()
ax.scatter(x, y)
# Set x and y axes labels, legend, and title
ax.set_title("Title")
ax.set_xlabel("X_Label")
ax.set_ylabel("Y_Label")