matplotlib.pyplot.hist(
x, bins=10, range=None, normed=False,
weights=None, cumulative=False, bottom=None,
histtype=u'bar', align=u'mid', orientation=u'vertical',
rwidth=None, log=False, color=None, label=None, stacked=False,
hold=None, **kwargs)
- x : 要画直方图的数据。
- bins :指定bin(箱子)的个数。也可以是list序列,表示bins的左边界和右边界。
- density(也就是normed参数): 设置为True,返回值的第一个是概率密度, 直方图下的面积(或积分)之和为1.
(density : bool, optionalIf True, the first element of the return tuple will be the counts normalized to form a probability density, i.e., the area (or integral) under the histogram will sum to 1. This is achieved by dividing the count by the number of observations times the bin width and not dividing by the total number of observations. If stacked is also True, the sum of the histograms is normal