import matplotlib.pyplot as plt from random import randint x_scatter=[] for num in range(1,1000): new= randint(1,100) x_scatter.append(new) y_scatter=[] for y in range(1,1000): yy=randint(1,100) y_scatter.append(yy) """绘制散点图""" #在x=2,y=4的位置绘制一个粗细为20的点 plt.scatter(x_scatter,y_scatter,s=20,c=(0.2,0.8,0.1),edgecolors='none') #设置图表的样式 plt.title("title show ",fontsize=24) plt.xlabel("x values view",fontsize=14) plt.ylabel("y values view",fontsize=14) plt.tick_params(axis='both',which='major',labelsize=14) #设置每个坐标的取值范围 plt.axis([10,88,0,99]) #保存到图片 plt.savefig("aa.png") plt.show()