I'm new to ggplot and I'm trying to figure out how to add a legend to a graph and re-label the x-axis. I've enclosed the plotting code and resulting graph . I would like to add a legend that explains what the blue line and the green and red dots are. I would also like the years on the x-axis to appear as 2018, 2019, ... , 2020 instead of 2017.5, 2010.0, ..., 2020.0. I can't find a solution in the online documentation. Thanks for your help.
ggplot(data = annual_rate_preds) +
geom_point(mapping = aes(x = year, y = predicted), color = 'green') +
geom_line(mapping = aes(x = year, y = observed), color = 'blue') +
geom_point(data = backfit_rate_preds, mapping = aes(x = target_year, y = rate_pred),
shape = 18, color = 'red', size = 2) +
theme(plot.title = element_text(size = 10))