官文链接:https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter
散点图的绘制。
scatter(x,y,s=None,c=None,marker=None,cmap=None,norm=None,vmin=None,vmax=None,alpha=None,linewidths=None,,edgecolors=None,plotnonfinite=False,data=None,*kwargs)
x,y是坐标的设定。
s控制marker的大小,一般是points**2。
练习:
1:
import matplotlib.pyplot as pltimport numpy as npx = [1,2,3,4,5]y = [6,7,8,9,10]#散点图的设置plt.scatter(x,y, marker='^', c='c')#s控制点大小,可以数组对应,可以一个单值plt.scatter([11,12,13,14,15],y,s=[100,1,2,3,4], marker='^', c='g')plt.show()
