w3resource

Matplotlib Scatter: Draw a scatter plot with empty circles taking a random distribution in X and Y

Matplotlib Scatter: Exercise-2 with Solution

Write a Python program to draw a scatter plot with empty circles taking a random distribution in X and Y and plotted against each other.

Sample Solution:

Python Code:

import matplotlib.pyplot as plt 
import numpy as np 
x = np.random.randn(50) 
y = np.random.randn(50)
plt.scatter(x, y, s=70, facecolors='none', edgecolors='g')
plt.xlabel("X")
plt.ylabel("Y")
plt.show()

Sample Output:

Matplotlib Scatter: Draw a scatter plot with empty circles taking a random distribution in X and Y

Python Code Editor:

Contribute your code and comments through Disqus.:

Previous: Write a Python program to draw a scatter graph taking a random distribution in X and Y and plotted against each other.
Next: Write a Python program to draw a scatter plot using random distributions to generate balls of different sizes.

What is the difficulty level of this exercise?



Become a Patron!

Follow us on Facebook and Twitter for latest update.

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-2.php