library(ggplot2)
gp_temp <- read.csv("temp_data.csv")
us_gtep <- read.csv("temperature_fig-1.csv")
attach(gp_temp)
p1<- ggplot(data = gp_temp, aes(x = year))+
geom_line(aes(y = anomaly, color = "Temperature Anomaly"))+
geom_point(aes(y = anomaly, color = "Temperature Anomaly"))+
scale_x_continuous(breaks = seq(1987,2017,10))+
scale_y_continuous(breaks = seq(-0.8,2.4,0.4))+
geom_hline(yintercept = 0, color = "blue")+
geom_hline(yintercept = 2.57, color = "grey")+
geom_hline(yintercept = -0.65, color = "grey")+
theme_classic()+
guides(color=guide_legend(title="Legend"))+
theme(legend.position = "bottom")+
labs(title = "Global Warming Changed Over the Past Decades", x = "Years",
y = "Temperature Anomaly")
The following is the output plot: