Add safety check when too many gridlines are made in a plot