Note

Go to the endto download the full example code.

scatter(x, y)#

A scatter plot of y versus x with varying marker size and/or color.

Seescatter.

scatter plot
importmatplotlib.pyplotaspltimportnumpyasnpplt.style.use('_mpl-gallery')# make the datanp.random.seed(3)x=4+np.random.normal(0,2,24)y=4+np.random.normal(0,2,len(x))# size and color:sizes=np.random.uniform(15,80,len(x))colors=np.random.uniform(15,80,len(x))# plotfig,ax=plt.subplots()ax.scatter(x,y,s=sizes,c=colors,vmin=0,vmax=100)ax.set(xlim=(0,8),xticks=np.arange(1,8),ylim=(0,8),yticks=np.arange(1,8))plt.show()

Gallery generated by Sphinx-Gallery