I am creating histograms of data organized in a dataframe and grouped by days. It might happen that in some days the data is identically null. Therefore, when I plot the histogram using the normed = True
property, I would expect one single bin centered in zero and with height equal to 1. However, I see that the height is equal to the number of bins. How can I fix this? I want to represent a probability density function with the histogram, so the maximum value should be 1.
Code sample and output:
plt.rcParams['figure.figsize'] = 10, 4
data = np.zeros((1000))
l = plt.hist(data,normed = True, bins = 100)
EDIT: I saw now that the property normed
is deprecated. However, if I try to use the attribute density
, I get the error AttributeError: Unknown property density