Scatter Plot: This is a chart used to visualize the relationships between two variables, helping to determine the correlation in a data set.
Draw a scatter plot using matplotlib.pyplot.scatter()
:
import matplotlib.pyplot as plt
import numpy as np
# Sample data
x_data = np.random.rand(50) * 10
y_data = np.random.rand(50) * 10
# Create the scatter plot
plt.scatter(x_data, y_data)
# Add labels and a title
plt.xlabel("X-axis Label")
plt.ylabel("Y-axis Label")
plt.title("Simple Scatter Plot")
# Display the plot
plt.show()
Output: