So right now I have a bunch of data where y-values represent a recorded intensity, and x-values are the wavelength associated with said intensity. Currently, I am trying to plot a distribution of the intensities at a given wavelength, so after filtering my data to a specific wavelength (or 'x' value) it looks something like:
y0 y1 y2 ... y47 y48 y49
675 0.005513 0.007296 0.00572 ... -0.000084 -0.004105 -0.001181
Now, I try to create a histogram from that data by using the following code:
plt.hist(wavelength_338.iloc[[2], :-1], bins = 5, ec= 'skyblue')
plt.xlabel("Δy (y\u0305 -y)")
plt.ylabel("Count")
plt.title("Δy Distribution for 338.05 nm")
plt.show()
Note, I calculated the number of bins by using the Freedman-Diaconis rule. Here is a link to the plot:
It is clearly making more than 5 bins and I cannot seem to figure out why.



numpy.randomor remove theec='skyblue'(the individual histograms will have different colors).