python 2-5(2019-11-01 )(下)

绘制散点图

from matplotlib import pyplot as plt
import numpy as np
x = [i for i in range(10)]
x
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
y = [i for i in range(10)]
y
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
plt.scatter(x,y)
plt.show()
output_4_0.png
z = np.arange(10)
w = np.arange(10)
plt.scatter(z,w)
plt.show()
output_6_0.png
# 绘制正太分布的散点图
# 均值为0,方差为1的1000000个数据
x = np.random.normal(0,1,1000000)
y = np.random.normal(0,1,1000000)
plt.scatter(x,y,alpha=0.1)
plt.show()
output_8_0.png

你可能感兴趣的:(python 2-5(2019-11-01 )(下))