Let say you have distance in D. You first have to take Histogram. For histogram if you know the number of bins then can give it as input or by default value will be applied. In given figure there are I assume 140 bins. So your code goes as follow:
h = hist(D,140);
h = h/sum(h);
bar(h, 'DisplayName', 'Travel Distance');
Do let me know If I answered your question correctly.