matplotlib draws random scatterplots

an introduction

Scatter plot is a common method for analyzing data correlation. The following code uses random numbers to generate numerical values, then generates a scatter plot, and calculates the size of the scatter points according to the magnitude of the values.
two code
  1. import matplotlib.pylab as pl
  2. import numpy as np
  3. x = np.random.random(100)
  4. y = np.random.random(100)
  5. #s指大小,c指颜色,marker指符号形状
  6. pl.scatter(x,y,s=x*500,c=u'r',marker=u'*')
  7. pl.show()
Three running results

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327044550&siteId=291194637