Try adding this layer to your ggplot:
scale_y_continuous(breaks=seq(min(data$Y),max(data$Y),(max(data$Y)-min(data$Y))/20))
The breaks=
argument takes a vector that allows you to manually specify the breaks. To get 20 equally spaced values from the lowest to highest values in data$Y
the seq
function comes in handy. You could also wrap the seq()
function with round()
function to clean up the potentially messy numbers that result from max()-min()/20
.