Add back algorithm to determine y range for plot