I got data about frequencies each year. I barplotted these data (x - years; y - frequencies) with ggplot2. Now I want to separate the barplot diagram by coloring all bars below of 1980 with red and all bars equal or higher than 1980 with green. How can I do this - below is my MWE with trying to set these borders with scale_fill_manual which is not working because I don't do it correctly.
Data
dput(allePubs2)
structure(list(Jahr = 1922:2015, Publikationen = c(1L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L,
0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 2L, 0L, 0L, 0L, 1L, 0L, 1L, 4L,
2L, 3L, 2L, 2L, 4L, 1L, 4L, 1L, 3L, 6L, 1L, 2L, 2L, 3L, 1L, 2L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 12L, 4L, 5L, 14L, 9L, 6L, 5L, 7L,
5L, 6L, 4L, 7L, 3L, 7L, 6L, 7L, 8L, 6L, 4L, 14L)), .Names = c("Jahr",
"Publikationen"), row.names = c(NA, -94L), class = "data.frame")
MWE attempt
cutoff80 <-
ggplot(data=allePubs2, aes(x=Jahr, y=Publikationen)) +
geom_bar(stat="identity", width = 0.5)+
scale_y_continuous(name="Anzahl Publikationen", breaks = 0:14, limits = c(0, 15))+
scale_x_continuous(name="Jahr", breaks = c(1920, 1925, 1930, 1935, 1940, 1945, 1950, 1955, 1960, 1965, 1970, 1975,
1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015),
limits = c(1920, 2016))+
ggtitle("Cut-Off bei 1980")+
theme_hc() +
geom_vline(xintercept = 1979.5)+
scale_fill_manual(breaks = c("1922", "1979","1980","2016"),
values=c("red", "red", "green", "green"))
cutoff80