Overview

Starting from 1970s, Saudi Arabia went through deep transformations at almost every single level. The increase of oil prices has resulted in a massive revenues that enabled the country to experience an exceptional era of economic and social development. Mega projects, high increase of consumption and flood of foreign labourers have all been the remarkable characteristics of that time. In order to meet the growing domestic needs of food, Saudi Arabia launched a strategic agricultural project to plant the desert. Massive circular plantations were established aiming at supplying the local market with basic basket of vegetables and fruits. The cultivation of fodder crops has also widely extended to meet the increasing need for cattle and poultries. However, this agricultural project, combined with the climate change caused damage to the water reservoir of the country. That is, maintaining high level of consumption and catching up with the increase in population have both put a tremendous pressure on the water resources and boosted the need for new sources for drinkable water. From the beginning of 1980s, Saudi Arabia started to invest billions of dollars to establish desalination plants along the shores of the Gulf and the Red Sea. More than twenty plants were established since then including “Ras Al-Khair” facility, the world’s largest water desalination plant. Today, these plants account for 69% of the total drinkable water distributed through the national grid and more plants are scheduled on the track. The Saudi government aims at attracting 60$ billion in investments in the water sector in the next few years and seeks a strategy to engage the private sector in its efforts to increase the production of desalinated water to 8.8 million cubic meters by 2030.

Data

The data for the graph is extracted from the statistical book of 2017 of the Saudi Ministry of Environment, Water & Agriculture. The data compiles the production levels of drinkable water according to its source over the period from 2007 to 2017.

Packages used in visualizing the graph

library(readxl)
library(ggplot2)
library(ggthemes)
library(scales)
library(dplyr)
library(tidyr)
library(gridExtra)
library(devtools)
library(tidyverse)

Importing and Manipulating the Data

saudiwater <- read_excel("C:/Users/Rami/Desktop/Files/saudiwater.xlsx")
saudiwater <- as.data.frame(saudiwater)
head(saudiwater)
##   Year Underground Desalinated
## 1 2007         910        1067
## 2 2008         942        1063
## 3 2009         978        1145
## 4 2010        1025        1258
## 5 2011         947        1476
## 6 2012         981        1546
tail(saudiwater)
##    Year Underground Desalinated
## 6  2012         981        1546
## 7  2013        1137        1594
## 8  2014        1189        1685
## 9  2015        1190        1835
## 10 2016        1182        1947
## 11 2017         975        2175
saudiwater <- gather(saudiwater, water, number, -Year)
head(saudiwater)
##   Year       water number
## 1 2007 Underground    910
## 2 2008 Underground    942
## 3 2009 Underground    978
## 4 2010 Underground   1025
## 5 2011 Underground    947
## 6 2012 Underground    981
tail(saudiwater)
##    Year       water number
## 17 2012 Desalinated   1546
## 18 2013 Desalinated   1594
## 19 2014 Desalinated   1685
## 20 2015 Desalinated   1835
## 21 2016 Desalinated   1947
## 22 2017 Desalinated   2175

Note: We need to play abit more with our data in order to make the bars taking an ascending order: the bars for smaller values (Underground water in our case) should be plotted first. This can be done by transforming water into factor and sorting the levels in a way that shows underground first.

saudiwater$water <- factor(saudiwater$water, levels = c("Underground", "Desalinated"))

Plotting the Graph

ggplot() +
  geom_bar(aes(x= Year, y= number, fill = water), data = saudiwater, position = "dodge", stat = "identity", width = 0.5) + 
  theme_minimal() + 
  scale_fill_manual(values = c("#0a4c6a", "aquamarine")) + 
  scale_x_continuous(breaks = seq(2007, 2017, 1)) + 
  scale_y_continuous(limits = c(0, 2200), breaks = c(0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2200), labels = scales::comma) + 
  theme(axis.line.x = element_line(colour = "black", size = 1.5)) +
  theme(axis.text.x = element_text(colour = "black", size = 11)) + 
  theme(axis.text.y = element_text(colour = "black", size = 11)) + 
  theme(axis.title.y = element_blank()) + 
  theme(axis.title.x = element_blank()) + 
  theme(legend.position = "bottom") +
  theme(legend.title = element_blank()) + 
  theme(panel.grid.major.x = element_blank()) + 
  theme(panel.grid.minor.x = element_blank()) + 
  theme(legend.text = element_text(colour = "black", size = 12, face = "bold")) +
  theme(legend.key.size = unit(1.1, "lines")) + 
  labs(title ="The Consumption of Drinkable Water in Saudi Arabia", subtitle = "Million Cubic Meter", 
       caption = "source: Ministry of Environment, Water & Agriculture") +
  theme(plot.title = element_text(size = 15, face = "bold"))