Matplotlib Scatter: Draw a scatter graph taking a random distribution in X and Y
Matplotlib Scatter: Exercise-1 with Solution
Write a Python program to draw a scatter graph taking a random distribution in X and Y and plotted against each other.
Sample Solution:
Python Code:
import matplotlib.pyplot as plt
from pylab import randn
X = randn(200)
Y = randn(200)
plt.scatter(X,Y, color='r')
plt.xlabel("X")
plt.ylabel("Y")
plt.show()
Sample Output:
Python Code Editor:
Contribute your code and comments through Disqus.:
What is the difficulty level of this exercise?
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/graphics/matplotlib/scatter/matplotlib-scatter-exercise-1.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics