Plotly histogram get number of bins or bin size

I’m using plotly.js to draw a histogram of a bunch of points that roughly follows a normal distribution. I want to draw a normal distribution curve on top of it. However, I can only do that if I know what the bin size is.

y = probabilityDensityFunction(x, mean, sigma) * number_of_points * BIN_SIZE

I’d like to keep using the autobinning rather than specifying the bin size manually.

Is there any way to get the bin size from a plotly plot?

You can try digging into our internal variables:


should have the values you want.