distplot()
绘制概率密度分布图
x_norm1=np.random.randn(1000)
x_norm2=2+np.random.randn(1000)
x_norm3=3*x_norm1+0.2*np.random.randn(1000)
plt.rcParams['font.sans-serif'] = 'SimHei'#设置字体为SimHei显示中文
plt.rcParams['axes.unicode_minus']=False#显示负号
plt.rc('font', size=14)#设置图中字号大小
sns.distplot(x_norm1,bins=50)
plt.title('x_norm1的分布')
x_norm1=np.random.randn(1000)
x_norm2=2+np.random.randn(1000)
x_norm3=3*x_norm1+0.2*np.random.randn(1000)
plt.rcParams['font.sans-serif'] = 'SimHei'#设置字体为SimHei显示中文
plt.rcParams['axes.unicode_minus']=False#显示负号
plt.rc('font', size=14)#设置图中字号大小
sns.distplot(x_norm1,bins=50)
plt.title('x_norm1的分布')
plt.rcParams['font.sans-serif'] = 'SimHei'#设置字体为SimHei显示中文\n",
plt.rc('font', size=14)#设置图中字号大小\n",
sns.distplot(x_norm1,color="r",bins=50)
sns.distplot(x_norm2,color="g",bins=50)
sns.distplot(x_norm3,color="b",bins=50)
plt.legend(['x_norm1','x_norm2','x_norm3'])
plt.title('多个特征分布')
plt.show()
displot()方法,bins参数设置分箱数,hist 用于设置是否绘制直方图; kde参数设置是否绘制高斯核密度估计结果;rug参数设置是否在坐标轴上绘制特征值的标识; vertical 设置是否使用y轴表示观测值; norm_hist参数设置是使用概率数量。