Black Lives Matter. Please consider donating to Black Girls Code today.

Histogram and bin size

I have some difficulties to set the bin width. In the example below, I am trying to set the bin size to 0.1 but the resulting histogram width is 0.5.

When changing my test value “1” to a lower value, it works. It also works if I add other values in my test value array but it won’t if the test value only contains “1”.
Did I misunderstand the use of the nbinsy, ybins parameters ?

Here is my jsfiddle.

Right. Our autobin algorithm can be lead to confusing results for 1-pt samples.

You might want to read for explanations and possible workarounds.

OK thank you for the link.