How can I create a scatter plot using matplotlib in Python?
How can I create a scatter plot using matplotlib in Python?
How can I create a scatter plot using matplotlib in Python?
solveurit24@gmail.com Changed status to publish February 13, 2025
Use the matplotlib.pyplot module:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
plt.scatter(x, y)
plt.title("Scatter Plot Example")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()Explanation:
plt.scatter(x, y)creates the scatter plot.plt.show()displays the plot.
solveurit24@gmail.com Changed status to publish February 13, 2025