# 运用散点图对数据分布得到直观的认识
import numpy as np
import matplotlib.pyplot as plt # 设计 x, y 轴
n = 10000
x = np.random.randn( n ) # 随机值
y = np.random.randn( n ) # 显示散点图
colors = ['b','r','g','y','k','m']
plt.scatter(x, y, c = colors, marker = 'p', alpha=0.5 )
plt.title('Distribution')
plt.show() # scatter( x, y, s = None, c = None, maker = None,
# camp = None, norm = None, vmin = None, vmax = None,
# alpha = None, linewidth = None, vert = None, edgecolors = None,
# hold = None, data = None, **kwargs
# )
# x,y - 形如shape(n,)的数组,可选值
# s - 点的大小(也就是面积)默认20
# c [color] - 点的颜色或颜色序列,默认蓝色。其它如c = 'r' (red); c = 'g' (green); c = 'k' (black) ; c = 'y'(yellow)
# marker 形状,可选值,默认是圆 [. , _ o v ^ < > 1 2 3 4 8 s p P * h H + x X D] # alpha - 透明度,标量,可选,默认值:无, 0(透明)和1(不透明)之间的alpha混合值
# edgecolors - 边缘颜色或颜色序列,可选值,默认值:None
散点图结果:
结论:
从图像上看,散点呈均匀分布。