1. 介绍
seaborn.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)
其中,
a : 序列Series或列表或1维数组;
bins : 直方图桶的个数;
hist : bool, optional,是否绘制直方图;
color : matplotlib color, optional;
label : string, optional,说明的标签;
ax : matplotlib axis, optional;
kde : bool, optional,Whether to plot a gaussian kernel density estimate.
rug : bool, optional,Whether to draw a rugplot on the support axis.
fit : random variable object, optional;An object with fit method, returning a tuple that can be passed to a pdf method a positional arguments following an grid of values to evaluate the pdf on.
vertical : bool, optional;If True, observed values are on y-axis.
norm_hist : bool, optional
If True, the histogram height shows a density rather than a count. This is implied if a KDE or fitted density is plotted.
axlabel : string, False, or None, optional
Name for the support axis label. If None, will try to get it from a.namel if False, do not set a label.
2. 使用
示例1:
import seaborn as sns,numpy as np
sns.set()
np.random.seed(0)
x=np.random.randn(100)
ax=sns.distplot(x)
效果:
示例2:
ax = sns.distplot(x, fit=norm, kde=False)
reference:
- seaborn tutorials