fixed calculation of space at the bottom of the graph