matplotlib 的直方图函数返回奇怪的 y 轴值

Historgram function for matplotlib returning weird y-axis values

我正在尝试了解 matplotlib.hist 函数。我有以下数据:

cs137_count = np.array([this has a size of 750 and integers in the range from 1820 to 1980])
plt.figure()
plt.hist(cs137_count, density=True, bin = 50)  
plt.ylabel('Distribution')
plt.xlabel('Counts');

但是它提供的情节在 0 - 0.016 范围内的 y-axis 有奇怪的值,这没有任何意义,我不确定为什么 returns 这些值?我附上了下面的情节图片。

那是因为您正在使用 density=True。来自docs

density: bool, optional

If 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 normalized to 1.

Default is False.