# Use scatter () to draw a scatter plot

Use scatter () to draw a scatter plot

Prior wrote, using magic function quickly drawing tutorial: https://www.cnblogs.com/jiading/p/11750001.html. However, this method is suitable for a histogram, scatter, then use the following code :

import matplotlib.pyplot as plt
X=[-1,0,1,2,3,4,-4,8,2,0,-2]
y=[0,1,2,3,4,5,6,7,8,9,10]
count=len(X)
for i in range(count):
    plt.scatter(X,y,c=y,cmap=plt.cm.Reds)
plt.show()

Drawn is this:

Guess you like

Origin www.cnblogs.com/jiading/p/11967724.html