# Importing all the necessary packages
library(ggplot2)
library(tidyverse)
library(dplyr)
library(sf)
library(sp)    # for static and interactive maps
library(leaflet) # for interactive maps
library(rnaturalearth)
library(leaflet.extras)
library(sp)
library(wbstats)
library(kableExtra)
library(formattable)
library(gridExtra) #to organize the graphs
library(rgeos)
library(ggalt)
#Aesthetic variables
violet <- c("#36328C")
rose <- c("#D81E5B")
bleu <- c("#8DE4FF")
jaune <- c("#FFC914")
vert <- c("#8AD973")
white <- c("#FFFFFF")
black <- c("#000000")
bleu2 <- c("#5AA9E6")
mycols1 <- c(violet,rose)
mycols2 <- c(white,rose)
mycols3 <- c(violet,rose,bleu)
mycols4 <- c(violet,rose,jaune,bleu,vert)
mycols6 <- c(violet,rose,jaune,bleu,vert,bleu2)
#Loading the datasets
load("EU emissions by country and source.rdata") #scem
load("Long term emission per capita by country.rdata") #ctrem
load("Long term emission per capita worldwide.rdata") #ltem
load("Targets European Climate Law.rdata") #targ

Introduction

In a context where the COP26 starts next week, the N.G.O “Your Datattention” represented by Ibrahim Meddioui and Théotime Bourgeois have been commissioned to prepare a short report summarising the situation of greenhouse gas emissions in Europe and in the world so that Ursula Von Der Leyen can rely on it during her speech.

« C’est une triste chose de songer que la nature parle et que le genre humain n’écoute pas - It is a sad thing to think that nature speaks and mankind does not listen »
Victor Hugo

CO2 emission evolution in the world

CO2 emissions have been growing for 250 years

# Long term evolution of CO2 emissions per capita worldwide (1750-2019)
#Creating the labels
ltem$label <- ltem$year
ltem$label[!(ltem$label %in% c(1918, 1939, 1975, 1995))] <-
  NA # Keeping the labels of these intersting years
#Filtering the data
ltem <- filter (ltem, ltem$year <= 2019)
#Bulding the graph
ltem_graph_co2_world <- ggplot(ltem, aes(x = year, y = co2_per_capita)) +
  geom_area(fill = mycols4[1]) +
  geom_text(
    aes(label = ltem$label),
    nudge_x = 0,
    nudge_y = 0.5,
    size = 3,
    check_overlap = T
  ) +
  scale_x_continuous(breaks = seq(1750, 2019, 50)) + 
  theme(
    legend.position = "none",
    panel.background = element_blank(),
    axis.line = element_line()
  ) +
  labs(
    title = "Long term evolution of CO2 emissions per capita worldwide",
    subtitle = "1750-2019",
    y = "CO2 per capita",
    x = "Year"
  )
ltem_graph_co2_world

CO2 emissions are a recent concern that has been growing since the end of the Second World War. On this graph, we see three areas of growth:

  • A first exponential growth from the mid-19th to the 20th century due to the industrial revolution.
  • A second one from the 45’s lasting all of the 30 Glorious years, i.e. until the 75’s.
  • A third from the 95’s onward accompanying the IT revolution but fortunately, this growth has been slowed down by the laws put in place by the world institutions but we have reached a stable plateau which does not allow us to speak of a real decrease but more of a temporary stability.

COP 21 in Paris in 2015 started this movement followed by the 2019 Madrid Climate Change Conference.
But then, where are we up until 2019 and how do we prepare for the upcoming decades?


Distribution of the CO2 emissions per capita by region for 2019

load("Long term emission per capita by country.rdata") #ctrem
#The number of EU countries in the dataset
EU <- sum(ctrem$eu == 1)
#Grouping by region according to the mean of CO2/Cap
ctrem <- ctrem %>%
  group_by(region) %>%
  summarize(co2_per_capita = mean(co2_per_capita, na.rm = T))
#Factoring the regions order
ctrem$region <- fct_reorder (ctrem$region, ctrem$co2_per_capita)
#Building the graph
ctrem_graph_co2_region <- ggplot(ctrem, aes(x = region, y = co2_per_capita)) +
  geom_bar(stat = "summary",
           fun = "mean",
           aes(fill = ctrem$co2_per_capita > mean(ctrem$co2_per_capita))) +
  scale_fill_manual(values = mycols4) +
  labs(
    title = "Distribution of the CO2 emissions per capita by region",
    subtitle = "2019",
    y = "CO2 per capita",
    x = NULL
  ) +
  geom_hline(yintercept = mean(ctrem$co2_per_capita)) +
  scale_x_discrete(guide = guide_axis(n.dodge = 2)) +
  scale_y_continuous(breaks = seq(0, 18, 2)) +
  geom_text(
    aes(label = round(co2_per_capita, 2)),
    nudge_x = 0,
    nudge_y = 0.5,
    check_overlap = T
  ) +
  theme(
    legend.position = "none",
    panel.background = element_blank(),
    axis.line = element_line()
  )
ctrem_graph_co2_region

In 2019, the differences between countries development wise have deepened more than ever. A dominance majority of North America followed by Europe and the most industrialized Asia. Africa is last in this emission race. The whole thing remains to be monitored since CO2 emissions go hand in hand with the development of industries and Africa and Asia will surely have good prospects for development in the coming years. Although this conference focuses on European countries, we can see that actions must be taken collectively with North and South American countries to achieve this global objective. Europe also has a crucial role to play, together with the 27 EU countries, it is only through effective action that we will be able to initiate the inertia to effectively reduce global CO2 emissions.

# load dataset
load("Long term emission per capita by country.rdata") #ctrem
#Selecting important columns
data <- ctrem %>% select(country, region, co2_per_capita)
#Renaming the cols
colnames(data) <- c("individual","group","value")
Top <- 40
#Reording the data
data <- head(data %>% arrange(-value),Top)
data <- data %>% arrange(group,value)
#Creating a unique ID
data$id <- seq(1, nrow(data))
data$value <- round(data$value,2)
#Building the data frame
infos_region <- as.data.frame(matrix(NA,nrow=6,ncol=4))
colnames(infos_region) <- colnames(data)
#fill-up the data frame
for (i in 1:6){
  country <- data$individual[data$group==unique(data$group)[i]]
  infos_region[i,] <- data[data$individual==country[length(country)],]
}
# Get the name and the y position of each label
# Using polar coords to generate a circular graph
label_data=data
number_of_bar=nrow(label_data)
angle= 90 - 360 * (label_data$id-0.5) /number_of_bar
label_data$hjust<-ifelse( angle < -90, 1, 0)
label_data$angle<-ifelse(angle < -90, angle+180, angle)
# Buulidng the plot
dist_co2_region <- ggplot(data, aes(x=as.factor(id), y=value, fill=group)) +
  geom_bar(aes(x=as.factor(id),y=value, fill=group),
           stat="identity") +
  scale_fill_manual(values=colorRampPalette(mycols1)(6)) +
  ylim(-100,100) +
  theme_minimal() +
  theme(legend.position = "right",
        legend.title = element_blank(),
        axis.text = element_blank(),
        axis.title = element_blank(),
        panel.grid = element_blank()) +
  coord_polar() +
  geom_text(data=label_data,
            aes(x=id, y=value+10, label=paste(individual,"(",round(value,1),")"), hjust=hjust),
            color="black",
            size=2.5,
            angle= label_data$angle,
            inherit.aes = FALSE )+
  labs(title="Distribution of the CO2 emissions per capita by country and region",
       subtitle="2019",
       y="CO2 per capita",x=NULL)
 
dist_co2_region

Each region of the world obviously has its major players that contribute to the increase of CO2 emissions. The graph below shows the top 40 emitting countries by region, with the most important ones are hereby listed by region:

  • New Caledonia - East Asia & Pacific : 29.89
  • Kazakhstan - Europe & Central Asia : 16.92
  • Curaçao - Latin America & Caribbean : 31.79
  • Qatar - Middle East & North Africa : 38.61
  • United States - North America : 16.06
  • South Africa - Sub-Saharan Africa : 8.17

Each of these 6 countries stands out significantly and should be monitored to enable a comprehensive long-term strategy to achieve CO2 emissions reduction.
This top 40 is a perfect snapshot of the current state of our world showing major disparities/inequalities between countries around the world with uneven levels of industrialization and development.

Interactive map of the CO2 emissions per Capita worldwide in 2019

# Loading the data
load("Long term emission per capita by country.rdata") #ctrem
#importing the world map data
map <- ne_countries()
names(map)[names(map) == "iso_a3"] <- "ISO3"
names(map)[names(map) == "name"] <- "NAME"
map <- cbind(map["NAME"],map["ISO3"])
#Adding CO2 emissions as a column 
map$co2 <- ctrem$co2_per_capita[match(map$ISO3,ctrem$iso3)]
#Color palette for CO2 emissions
pal <- colorBin(
  palette = mycols2, domain = map$co2,
  bins = seq(0, max(map$co2, na.rm = TRUE)-10, by = 5)
)
# Removing NA
map <- map[!is.na(map$co2),]
# Creating labels
map$labels <- paste0(
  "<strong> Country: </strong> ",
  map$NAME, "<br/> ",
  "<strong> CO2 Emission in 2019: </strong> ",
  round(map$co2,2), "<br/> "
) %>%
  lapply(htmltools::HTML)
#Building the leaflet map
LeafMap <- leaflet(map) %>%
  setView(lng = 0, lat = 30, zoom = 1.3) %>%
  addPolygons(
    fillColor = ~ pal(co2),
    color = violet,
    weight = 1,
    opacity = 1,
    fillOpacity = 1,
    label = ~labels,
    highlight = highlightOptions(
      color = "white",
      bringToFront = TRUE,
      fill = 1, fillOpacity=1
    )
  ) %>%
  leaflet::addLegend(
    pal = pal, values = ~co2,
    opacity = 1, title = "CO2 per capita"
  )
LeafMap

Focus on Europe

The European Union over time

#Loading the data
load("Targets European Climate Law.rdata") #targ
countries <- as.data.frame(ne_countries())
countries <- select(countries, iso_a3, sovereignt)
for (c in length(targ$country)) {
  targ$country[c] <-
    countries$sovereignt[targ$iso3[c] == countries$iso_a3][!is.na(countries$sovereignt[targ$iso3[c] ==
                                                                                         countries$iso_a3])]
}
#Adding the population records to the dataset
targ$population <- NA
targ$co2_1 <- targ$co2 - mean(targ$co2[targ$year == 2014])
for (p in 1:length(targ$population)) {
  pop_sample <- population[population$country == targ$country[p], ]
  if (sum(pop_sample$year == targ$year[p]) > 0) {
    targ$population[p] <-
      pop_sample$population[pop_sample$year == targ$year[p]]
  } else
    NA
}
pop_min <-
  mean(targ$population[targ$year == min(targ$year[min(targ$population, na.rm = T) ==
                                                    targ$population], na.rm = T)], na.rm = T)
#Recentring the population so that it starts at 0
targ$pop_scale <- targ$population - pop_min
#Creating the scale factor (such as y = a*x+b)
a <-
  mean(targ$co2_1[targ$year == 1995], na.rm = T) / mean(targ$pop_scale[targ$year ==
                                                                         2013], na.rm = T)
#Rescaling the population
targ$pop_scale <- targ$pop_scale * a
#Setting the years limit
targ <- targ[targ$year <= 2014, ]
targ <- targ[targ$year >= 1995, ]
#Setting the CO2 labels elements
Seq_label_co2 <-
  seq(round(mean(targ$co2[targ$year == 2013]), 0), round(mean(targ$co2[targ$year ==
                                                                         1995]) + 5, 0), 5)
Seq_breaks_co2 <-
  seq(round(mean(targ$co2_1[targ$year == 2013]), 0), round(mean(targ$co2_1[targ$year ==
                                                                             1995]) + 5, 0), 5)
#Setting the population labels elements
Seq_label_pop <-
  seq(round(sum(targ$population[targ$year == 1995], na.rm = T), 0), sum(targ$population[targ$year ==
                                                                                          2013], na.rm = T) + 5, 6000000)
Seq_breaks_pop <-
  seq(round(sum(targ$pop_scale[targ$year == 1995], na.rm = T), 0), round(sum(targ$pop_scale[targ$year ==
                                                                                              2013], na.rm = T), 0) + 5, 130)
Seq_label_pop <- paste(round(Seq_label_pop / 1000000, 1), "M")
#The mean of CO2
Mean_CO2_2014 <- round(mean(targ$co2[targ$year == 2014]), 1)
#Building the graph
ctrem_graph_co2_vs_pop <- ggplot(targ, aes(x = year)) +
  geom_area(stat = "summary",
            fun = "mean",
            aes(y = pop_scale),
            fill = violet) +
  geom_bar(
    stat = "summary",
    fun = "mean",
    aes(y = co2_1),
    fill = rose,
    width = 0.5
  ) +
  scale_y_continuous(
    breaks = Seq_breaks_co2,
    labels = Seq_label_co2,
    sec.axis = sec_axis( ~ ., name = "Population Density", labels = Seq_label_pop),
    expand = c(0, 0)
  ) +
  scale_x_continuous(breaks = seq(1995, 2013, 2), expand = c(0, 0)) +
  scale_fill_manual(values = mycols4) +
  labs(
    title = "CO2 emissions per capita by EU country",
    subtitle = "",
    y = "CO2 per capita",
    x = NULL
  ) +
  geom_hline(yintercept = mean(targ$co2_1)) +
  theme(
    legend.position = "none",
    panel.background = element_blank(),
    axis.line = element_line(colour = violet),
    axis.title.y.left = element_text(
      angle = 90,
      vjust = 2,
      colour = rose
    ),
    axis.title.y.right = element_text(
      angle = 90,
      vjust = -2,
      colour = violet
    ),
    axis.text.y.left = element_text(
      angle = 0,
      hjust = 1,
      colour = rose
    ),
    axis.text.y.right = element_text(
      angle = 0,
      hjust = 1,
      colour = violet
    )
  )
ctrem_graph_co2_vs_pop


In order to understand what the next decisions of the European Union should be, it is essential to look back down to 1995. In fact, in 1995 both the fourth enlargement of the European Union and the first climate actions have taken place. In the following graph, we contrasted the population growth along with the CO2 emissions evolution.
We can highlight three acts: the first in 1995 which triggered a drop in emissions up until 2004 when new laws were adopted. The second act of 2004 illustrates that if no actions are taken, CO2 emissions will increase proportionally to the increase in population - mostly linked to industrial consumption. In 2007 however, new measures have been adopted and have resulted in a continuous drop of emissions per capita, with the exception of 2010, despite the increase of population.
In 2014, the average CO2 emissions was 143.6, which is, given the constant increase in population, a significant achievement.

CO2 emissions per capita by EU country for 2019

#Reloading the data
load("Long term emission per capita by country.rdata") #ctrem
#Filtering for EU countries
ctrem <- filter(ctrem, ctrem$eu == 1)
#Factoring the countries by CO2 emissions
ctrem$country <- fct_reorder (ctrem$country, ctrem$co2_per_capita)
#Building the graph
ctrem_graph_EU_2019 <-ggplot(ctrem, aes(x = country, y = co2_per_capita)) +
  geom_bar(stat = "summary", fun = "mean",aes(fill = ctrem$co2_per_capita > mean(ctrem$co2_per_capita))) +
  scale_fill_manual(values=mycols4)+
  scale_y_continuous(breaks = seq(0, 18, 2))+
  labs(title="CO2 emissions per capita by EU country",
       subtitle="2019",
       y="CO2 per capita",x=NULL) +
  geom_hline(yintercept = mean(ctrem$co2_per_capita)) +
  scale_x_discrete(guide = guide_axis(n.dodge=3)) +
  theme(legend.position = "none",
        panel.background = element_blank(),
        axis.line = element_line())
ctrem_graph_EU_2019



Europe is a historical region of industrialization. Countries like Germany, France, and Italy were among the most CO2 emitting nations per Capita up until the late 90’s
In 2019 however, it is the mid-eastern Europe countries that dominate the leaderboard of emissions, as shown on the map above. On the other hand, we will later conclude that the targets of the major emitters have increased the heterogeneity of the countries in Europe. The data shown in the graph is consistent with the current digital industry era where Luxembourg is becoming Europe’s largest emitter per Capita.

#reloading the data
load("Long term emission per capita by country.rdata") #ctrem
#Importing EU data
Europe <- ctrem[ctrem$eu == "1", ]
#Importing world data
world <- ne_countries(scale = "medium", returnclass = "sf")
#Adding CO2 column
for (e in 1:length(world$sovereignt)) {
  world$co2[e] <-
    sum(Europe$co2_per_capita[world$sovereignt[e] == Europe$country])
}
#Limiting the range of emissions
world <- world[world$co2 > 0, ]
world$co2[world$co2 > 10] <- 10
#Building the map
ggplot_map_EU <- ggplot(data = world) +
  geom_sf(aes(fill = co2)) +
  geom_sf_text(
    aes(label = toupper(sovereignt)),
    colour = "white",
    alpha = 0.9,
    size = 1.5,
    check_overlap = T
  ) +
  xlab("Longitude") +
  ylab("Latitude") +
  coord_sf(xlim = c(-25, 50),
           ylim = c(35, 70),
           expand = FALSE) +
  scale_fill_gradient(low = violet, high = rose) +
  theme(
    legend.position = "right",
    legend.title = element_blank(),
    text = element_text(size = 8),
    panel.background = element_blank(),
    axis.line = element_blank(),
    axis.text = element_blank(),
    axis.ticks = element_blank(),
    axis.title = element_blank()
  )
ggplot_map_EU

Contribution of CO2 emission sources by EU country for 2019

#Reloading the data
load("EU emissions by country and source.rdata") #scem
load("Long term emission per capita by country.rdata") #ctrem
#Filtering for EU
ctrem <- filter(ctrem, ctrem$eu == 1)
#Order by co2
ctrem <- ctrem[order(ctrem$co2_per_capita, decreasing = T), ]
#selecting top 10
top <- 10
ctrem <- head(ctrem, top)
#Checking if country exists in scem
for (k in 1:nrow(scem)) {
  scem$ctrem[k] <- max(as.numeric(scem$country[k] == ctrem$country))
}
#Filtering out the other sectors since no data is available
scem <- scem[scem$source != "Other sectors", ]
scem <- filter(scem, scem$ctrem == 1)
#Building first graph
graph_co2_sources_percentage <-
  ggplot(scem, aes(x = percentage, y = country, fill = source)) +
  geom_col(position = 'stack') +
  scale_fill_manual(values = mycols4) +
  labs(
    title = "Contribution of CO2 emission sources by EU country",
    subtitle = "in 2019",
    y = "Percentage",
    x = NULL
  ) +
  theme(
    legend.position = "top",
    legend.title = element_blank(),
    text = element_text(size = 10),
    panel.background = element_blank(),
    axis.line = element_line()
  )
graph_co2_sources_percentage
#Building second graph
graph_co2_sources_total <-
  ggplot(scem, aes(x = percentage, y = country, fill = source)) +
  geom_col(position = 'dodge') +
  scale_fill_manual(values = mycols6) +
  scale_y_discrete(guide = guide_axis(n.dodge = 1)) +
  labs(y = "Total", x = NULL) +
  theme(
    legend.position = "none",
    legend.title = element_blank(),
    text = element_text(size = 10),
    panel.background = element_blank(),
    axis.line = element_line()
  )
graph_co2_sources_total

European future

Trajectory to reach the targets set in the European Climate Law

#Reloading the data
load("Targets European Climate Law.rdata") #targ
#Detecting the min of co2 for all countries
for (k in 1:nrow(targ)) {
  targ$min[k] <- min(targ$co2[targ$country == targ$country[k]])
}
#Computing the difference with the mean
targ$diff <- targ$co2 - targ$min
#Creating the trajectory data frame
traj_country <- unique(targ$country)
traj_year <- seq(min(targ$year), max(targ$year), 5)
df_traj <-
  matrix(
    data = NA,
    nrow = length(traj_country),
    ncol = length(traj_year)
  )
rownames(df_traj) <- traj_country
colnames(df_traj) <- traj_year
for (k in 1:length(traj_country)) {
  myVar = traj_country[k]
  for (j in 1:length(traj_year)) {
    myVar2 = traj_year[j]
    df_traj[k, j] <-
      targ$co2[targ$country == myVar & targ$year == myVar2]
  }
}
#Preparing the data
df_traj <- df_traj[order(df_traj[, 1], decreasing = T), ]
df_traj <- as.data.frame(round(df_traj, 1))
df_traj <- select(df_traj, -`1990`)
#Plotting the table
head(df_traj, 10) %>%
  mutate("2030" = color_tile(violet, rose)(`2030`)) %>%
  mutate("1995" = color_tile(violet, rose)(`1995`)) %>%
  kable(escape = F, align = c(rep("c", 9))) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
  column_spec(1, bold = T) %>%
  column_spec(2, bold = T, color = white) %>%
  column_spec(9, bold = T, color = white)
1995 2000 2005 2010 2015 2020 2025 2030
Germany 1135.7 1062.0 1015.5 966.3 929.0 805.4 633.6 461.8
France 547.5 562.8 567.0 524.2 475.0 436.2 343.2 250.2
Italy 537.9 563.5 597.6 525.4 450.1 413.2 325.0 236.9
Poland 448.1 397.4 406.1 415.0 392.7 377.8 297.3 216.7
Spain 336.0 397.9 453.7 370.6 351.6 320.0 251.8 183.5
Romania 188.1 142.2 149.5 118.8 117.1 109.7 86.3 62.9
Netherlands 238.0 228.1 224.0 222.4 204.6 184.8 145.4 106.0
Czech Republic 158.3 151.1 149.8 141.6 129.7 119.5 94.0 68.5
Belgium 156.5 153.6 149.2 137.9 123.4 116.9 92.0 67.0
Greece 112.0 129.0 139.0 121.1 98.4 86.0 67.6 49.3
#Creating the trajectory by percentage of emissions to be reduced
df_traj_percent <- head(df_traj, 10)
#Preparing the data
for (t in ncol(df_traj_percent):1) {
  df_traj_percent[, t] <-
    (df_traj_percent[, t] / df_traj_percent[, 1] - 1) * 100
}
df_traj_percent <-
  as.data.frame(df_traj_percent[order(df_traj_percent[, ncol(df_traj_percent)], decreasing = F), ])
df_traj_percent <- round(df_traj_percent, 1)
#Plotting the table
df_traj_percent %>%
  mutate("2030" = color_tile(violet, rose)(`2030`)) %>%
  kable(escape = F, align = c(rep("c", 10))) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
  column_spec(1, bold = T) %>%
  column_spec(9, bold = T, color = white)
1995 2000 2005 2010 2015 2020 2025 2030
Romania 0 -24.4 -20.5 -36.8 -37.7 -41.7 -54.1 -66.6
Germany 0 -6.5 -10.6 -14.9 -18.2 -29.1 -44.2 -59.3
Belgium 0 -1.9 -4.7 -11.9 -21.2 -25.3 -41.2 -57.2
Czech Republic 0 -4.5 -5.4 -10.5 -18.1 -24.5 -40.6 -56.7
Greece 0 15.2 24.1 8.1 -12.1 -23.2 -39.6 -56.0
Italy 0 4.8 11.1 -2.3 -16.3 -23.2 -39.6 -56.0
Netherlands 0 -4.2 -5.9 -6.6 -14.0 -22.4 -38.9 -55.5
France 0 2.8 3.6 -4.3 -13.2 -20.3 -37.3 -54.3
Poland 0 -11.3 -9.4 -7.4 -12.4 -15.7 -33.7 -51.6
Spain 0 18.4 35.0 10.3 4.6 -4.8 -25.1 -45.4

Target for 2030

#Adding a country columns
df_traj$Country <- rownames(df_traj)
#Order by 1995 desc
df_traj <- df_traj[order(df_traj$`1995`, decreasing = T), ]
#Selecting top 15
Top <- 15
df_traj <- head(df_traj, Top)
#Compute the mean of the objectives as the delay accumulated up until 2019
Mean_Objective <-
  abs(round((mean((df_traj$`1995` - df_traj$`2020`) / (df_traj$`1995` - df_traj$`2030`)
  ) - (2020 - 1995) / (2030 - 1995)) * 100, 1))

#Building the plot
graph_co2_sources_dumbbel <-
  ggplot(df_traj, aes(
    x = `1995`,
    y = factor(Country, rownames(df_traj)),
    group = Country
  )) +
  geom_dumbbell(
    aes(xend = `2030`),
    color = rose,
    size = 0.75,
    point.colour.l = violet
  ) +
  geom_dumbbell(
    aes(xend = `2020`),
    color = violet,
    size = 0.75,
    point.colour.l = violet
  ) +
  geom_text(
    aes(label = round(`1995`, 0)),
    nudge_x = 0,
    nudge_y = 0.4,
    size = 3,
    check_overlap = T
  ) +
  scale_x_continuous(trans = "reverse") +
  labs(
    title = "Contribution of CO2 emission sources by EU country",
    subtitle = "in 2019",
    y = NULL,
    x = NULL
  ) +
  theme(
    text = element_text(size = 10),
    panel.background = element_blank(),
    axis.line = element_line()
  )
graph_co2_sources_dumbbel


This graph shows the evolution from 1995, while forecasting up to 2030, of the CO2 emissions sources for the top emmetting EU countries in 2019.
The line in blue corresponds to the path taken from 1995 to 2019. It is clear that despite all the years that have passed, a delay has been accumulated since the measures have taken place, with more than 31.3% of delay accumulated on average for these 15 countries.
Therefore, it is imperative to catch up. The predictions however seem to be positive since all European countries want to move towards a massive reduction of CO2 emissions as stated in the two tables shown in the section above.





Conclusion

load("Targets European Climate Law.rdata") #targ
targ$year_1 <- targ$year + 1 >= max(targ$year)
for (k in 1:nrow(targ)) {
  targ$co2_proj[k] <-
    targ$co2[targ$year_1[k] == targ$year &
               targ$country[k] == targ$country]
}
for (s in 1:length(targ$year)) {
  targ$max[s] <- max(targ$co2[targ$country[s] == targ$country], na.rm = T)
}
targ$percent <- round(100 * targ$co2 / targ$max, 2)

targ_evolution_graph <- ggplot(targ, aes(year, percent)) +
  geom_bin2d(binwidth = c(1, 5)) +
  scale_x_continuous(breaks = seq(min(targ$year, na.rm = T), max(targ$year, na.rm = T), 10)) +
  scale_fill_gradient(low = rose, high = violet) +
  labs(y = "CO2 Emission", x = "Year") +
  theme(
    text = element_text(size = 12),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    panel.background = element_blank(),
    legend.position = "none",
    axis.line = element_line(colour = violet)
  ) +
  labs(
    title = "Emission",
    subtitle = paste0("from ", min(targ$year, na.rm = T), " to ", max(targ$year, na.rm = T)),
    y = "Percentage of CO2 Emission per country",
    x = "Decade"
  )
targ_evolution_graph

To conclude, we would like to point out the importance of the subject in hand and the crucial aspects of the results drawn in this analysis. We began by establishing a comparative analysis between regions in the year 2019, then, we drove the analysis within a deeper frame and focused on the European Union countries. In this analysis we have highlighted three key elements:

  • The increase of CO2 emissions is correlated to the increase of the population over time
  • The establishment of regulations is an effective method to limit the CO2 emissions per capita
  • A delay of around 31.3% have been accumulated on average behind the targeted emissions initially set on 1995
load("Targets European Climate Law.rdata") #targ
targ$co2[targ$country=="France"& targ$year=="2010"]
## [1] 524.2008
population$population[population$country=="France"& population$year=="2010"]
## [1] 63230866