A better way to restrict the range of the plot.