Corrected calculation of distances in statistics plot.