How can I set limits on the x axis for a ggplot graph? My code is
ages <- 6:16 mu <- c(0.66849315, 0.55386301, 1.17609589, 0.26111781, 0.466
Use scale_x_continuous rather then scale_x_discrete.
scale_x_continuous
scale_x_discrete
df_GP + scale_x_continuous(breaks=ages)
If you want to zoom the x labels you can add limits parameter:
limits
scale_x_continuous(breaks=ages,limits=c(10, 17))