Workout Wednesday Inspiration: Global Temperatures

Why?

I was inspired by @hrbrmstr on Twitter this morning in multiple ways. One being his epic food photo last night, but also his post, Work Wednesday Redux. These posts he dedicates some time to putting together a reproduction or expansion upon some fun exciting or interesting data visualization from across the web. So naturally I wanted to get in on the action. I decided to mimic and expound upon the New York Times initial visualization from their article, How 2016 Became Earth’s Hottest Year on Record

The data can be downloaded from the NASA GISTEMP website.

It isn’t the most intense, or a highly technical thing, but I think the idea behind his workouts are to mess with elements, or techniques you aren’t quite used to. So here is what I did.


#packages
library(ggplot2)
library(tidyr)
library(viridis)
#temperature data in working directory
data<-read.csv('GLB.Ts+dSST.csv',skip=1)
#clean
tdata<-gather(data,"month",'AVG',2:13)
#plot & elements
credits<- "Notes: Only land-surface temperatures \nData: Goddard Institute for Space Studies <https://data.giss.nasa.gov/gistemp/>\nCredit: The New York Times <https://www.nytimes.com/>"
p<-ggplot(tdata,aes(x=Year,y=AVG,group=month,color=AVG))+
  geom_point(alpha=.65)+scale_color_viridis(name="Monthly averages of global air temperature (Celsius)\ndeviations from 1951-1980 means.",option='C')+
  theme_minimal()+
  labs(x=NULL, y=NULL, title="Deviations of Temperature Average",caption=credits)
p+theme(legend.justification=c(0,0), legend.position=c(0,.55))