Hi, I am looking to create a graph showing unemployment over the years and then adding in bars in the background of the plot highlighting periods of recession?
What code would I use for this? And do i need to use dates within the code?
Code I have tried is
ggplot(unemployment_data, aes(x=year, y=unemployment))+
However, I am unsure if how I use geom_rect() and if that is the correct function to use? Similarly, when I go to plot that ggplot as above, for some reason geom_line() doesnot work at appears with the error message
"geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic" - how do I fix this?
Thanks for any help