Trying to plot a graph using ggplot, but I can't seem to figure out how to display every single year in the x axis.
This is what my code looks like:
library(dslabs)
data(temp_carbon)
#view(temp_carbon)
# line plot of annual global, land and ocean temperature anomalies since 1880
temp_carbon %>%
select(Year = year, Global = temp_anomaly, Land = land_anomaly, Ocean = ocean_anomaly) %>%
gather(Region, Temp_anomaly, Global:Ocean) %>%
ggplot(aes(Year, Temp_anomaly, col = Region)) +
geom_line(size = 1) +
geom_hline(aes(yintercept = 0), col = colorblind_palette[8], lty = 2) +
geom_label(aes(x = 2005, y = -.08), col = colorblind_palette[8],label = "20th century mean", size = 4) +
ylab("Temperature anomaly (degrees C)") +
xlim(c(1880, 2018)) +
scale_color_manual(values = colorblind_palette) +
ggtitle("Global, Land and Ocean Temperatures from 1880-2018")