其他分享
首页 > 其他分享> > 图表可视化seaborn直方图|密度图|散点图

图表可视化seaborn直方图|密度图|散点图

作者:互联网

一、直方图distplot()

distplot(a, bins=None, hist=True, kde=True, rug=False, fit=None,hist_kws=None, kde_kws=None, rug_kws=None, fit_kws=None,color=None, vertical=False, norm_hist=False, axlabel=None,label=None, ax=None)

fig = plt.figure(figsize=(12,5))
ax1 = plt.subplot(121)
rs = np.random.RandomState(10)  # 设定随机数种子
s = pd.Series(rs.randn(100) * 100)
sns.distplot(s,bins = 10,hist = True,kde = True,rug = True,norm_hist=False,color = 'y',label = 'distplot',axlabel = 'x')
plt.legend()

ax1 = plt.subplot(122)
sns.distplot(s,rug = True, 
             hist_kws={"histtype": "step", "linewidth": 1,"alpha": 1, "color": "g"},  # 设置箱子的风格、线宽、透明度、颜色,风格包括:'bar', 'barstacked', 'step', 'stepfilled'        
             kde_kws={"color": "r", "linewidth": 1, "label": "KDE",'linestyle':'--'},   # 设置密度曲线颜色,线宽,标注、线形
             rug_kws = {'color':'r'} )  # 设置数据频率分布颜色

 

标签:None,seaborn,kde,kws,散点图,hist,直方图,rug,True
来源: https://www.cnblogs.com/Forever77/p/11427665.html