import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
"""
Create matrix of ones
"""
a = np.ones((5,10))
# end
"""
Make a scatter plot with random data
Color the points by distance from the origin
Scale the point size by y value
Add a color bar
Make it horizontal
Use the color scheme from red to blue
Make it a square aspect ratio
save to points.png
"""
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
"""
Create matrix of ones
"""
a = np.ones((5,10))
# end
"""
Make a scatter plot with random data
Color the points by distance from the origin
Scale the point size by y value
Add a color bar
Make it horizontal
Use the color scheme from red to blue
Make it a square aspect ratio
save to points.png
"""
x = np.random.rand(100)
y = np.random.rand(100)
r = np.sqrt(x**2 + y**2)
plt.scatter(x, y, c=r, s=y*100, cmap='RdBu',
orientation='horizontal')
plt.colorbar()
plt.axis('equal')
plt.savefig('points.png')
'PathCollection' object has no property 'orientation'
Go to Google Form