Objective
The objective of this visualization was to observe the change of average land temperature over the years in the city of Delhi. This was done mainly to observe the effects of global warming and to inform people about the same.
The targetted audience for this visualization is anyone who is concerned about global warming and also for people to understand the effects of global warming on surface temperature by taking an example of the change of average land temperatures of major cities over a period of years.
The visualisation chosen had the following three main issues:
Reference
*R and Beyond. (2017). Surface Temperatures of Major Cities in Australia and India. [online] Available at: https://pradeepadhokshaja.wordpress.com/2017/02/22/surface-temperatures-of-major-cities-in-australia-and-india/ [Accessed 18 Sep. 2019].
The following code was used to fix the issues identified in the original.
library(readr)
library(ggplot2)
library(dplyr)
climate_data <-read_csv("D:/MASTERS OF DATA SCIENCE/SEMESTER2/DATA VISUALISATION/ASSIGNMENT 2/climate data major cities.csv")
climate_data %>% head(10)
## # A tibble: 10 x 7
## dt AverageTemperat~ AverageTemperat~ City Country Latitude
## <date> <dbl> <dbl> <chr> <chr> <chr>
## 1 1849-01-01 26.7 1.44 Abid~ Côte D~ 5.63N
## 2 1849-02-01 27.4 1.36 Abid~ Côte D~ 5.63N
## 3 1849-03-01 28.1 1.61 Abid~ Côte D~ 5.63N
## 4 1849-04-01 26.1 1.39 Abid~ Côte D~ 5.63N
## 5 1849-05-01 25.4 1.2 Abid~ Côte D~ 5.63N
## 6 1849-06-01 24.8 1.40 Abid~ Côte D~ 5.63N
## 7 1849-07-01 24.1 1.25 Abid~ Côte D~ 5.63N
## 8 1849-08-01 23.6 1.26 Abid~ Côte D~ 5.63N
## 9 1849-09-01 23.7 1.23 Abid~ Côte D~ 5.63N
## 10 1849-10-01 25.3 1.18 Abid~ Côte D~ 5.63N
## # ... with 1 more variable: Longitude <chr>
Delhi_temp <-climate_data %>% filter(City == "Delhi") %>% select(-(Latitude:Longitude))
Delhi_temp$dt <- as.Date(Delhi_temp$dt)
Delhi_temp$Year <- format(Delhi_temp$dt, "%Y")
Delhi_temp$Month <- format(Delhi_temp$dt, "%m")
Delhi_temp <-
Delhi_temp %>% filter(Year %in% c(1796, 1846, 1896, 1946, 1996, 2012))
Delhi_temp$Month <- as.factor(Delhi_temp$Month)
Delhi_temp$Year <- as.factor(Delhi_temp$Year)
Delhi_temp
## # A tibble: 72 x 7
## dt AverageTemperatu~ AverageTemperatu~ City Country Year Month
## <date> <dbl> <dbl> <chr> <chr> <fct> <fct>
## 1 1796-01-01 14.6 2.37 Delhi India 1796 01
## 2 1796-02-01 17.1 1.94 Delhi India 1796 02
## 3 1796-03-01 21.5 2.61 Delhi India 1796 03
## 4 1796-04-01 28.7 2.12 Delhi India 1796 04
## 5 1796-05-01 33.7 2.00 Delhi India 1796 05
## 6 1796-06-01 34.3 3.02 Delhi India 1796 06
## 7 1796-07-01 31.3 2.40 Delhi India 1796 07
## 8 1796-08-01 30.5 2.84 Delhi India 1796 08
## 9 1796-09-01 29.1 3.17 Delhi India 1796 09
## 10 1796-10-01 26.1 1.75 Delhi India 1796 10
## # ... with 62 more rows
plt <-ggplot(data = Delhi_temp, mapping = aes(x = Month, y = AverageTemperature, color = Year))
plt <- plt + geom_point() + geom_line(aes(group = Year)) + scale_color_manual(values = c("brown", "navy", "red", "turquoise2", "seagreen", "orange"))
plt <- plt + labs(title = "The Average temperature in Delhi from 1796 to 2012") + theme_minimal()
Data Reference
*Berkeley Earth (2013). Climate Change: Earth Surface Temperature Data. [online] Kaggle.com. Available at: https://www.kaggle.com/berkeleyearth/climate-change-earth-surface-temperature-data [Accessed 18 Sep. 2019].
The following plot fixes the main issues in the original.