How to extract the most populated bin from a histogram

OK, I found the solution:

# get the height of the most populated bin:
bin_max = maximum(hist.weights)

# get the position of this bin in the weights list:
i = findfirst(x -> x==bin_max, hist.weights)

# get the values of the edges corresponding to this position
bin_pos = hist.edges[1][i:i+1]
3 Likes